- pdflatex = find_exe(["pdflatex"], path)
- if pdflatex != None:
- # Create a new LaTeX file from the original but only with failed pages
- pdf_latex_file = latex_file_re.sub("_pdflatex.tex", latex_file)
- filter_pages(latex_file, pdf_latex_file, failed_pages)
-
- # pdflatex call
- pdflatex_call = '%s "%s"' % (pdflatex, pdf_latex_file)
- pdflatex_status, pdflatex_stdout = run_command(pdflatex_call)
-
- pdf_file = latex_file_re.sub(".pdf", pdf_latex_file)
-
- # GhostScript call to produce bitmaps
- gs_call = '%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=%s ' \
- '-sOutputFile="%s%%d.%s" ' \
- '-dGraphicsAlphaBit=%d -dTextAlphaBits=%d ' \
- '-r%f "%s"' \
- % (gs, gs_device, latex_file_re.sub("", pdf_latex_file), \
- gs_ext, alpha, alpha, resolution, pdf_file)
-
- gs_status, gs_stdout = run_command(gs_call)
- if gs_status != None:
- # Give up!
- warning("Some pages failed with all the possible routes")
- else:
- # We've done it!
- pdf_log_file = latex_file_re.sub(".log", pdf_latex_file)
- pdf_metrics = legacy_extract_metrics_info(pdf_log_file)
-
- original_bitmap = latex_file_re.sub("%d." + output_format, pdf_latex_file)
- destination_bitmap = latex_file_re.sub("%d." + output_format, latex_file)
-
- # Join the metrics with the those from dvips and rename the bitmap images
- join_metrics_and_rename(legacy_metrics, pdf_metrics, failed_pages, original_bitmap, destination_bitmap)
+ legacy_conversion_pdflatex(latex_file, failed_pages, legacy_metrics, gs,
+ gs_device, gs_ext, alpha, resolution, output_format)