The following pipeline will be proceeded for a single graphics file.
The file will be copied to the "temp" subdirectory as "image.eps" or "image.ps".
A tex file called "out.tex" will be created in that directory.
It has the following conent:
<packages text>
\begin{document}
<document text>
[automatic PSFrag commands]
\begin{figure}
\begin{center}
\includegraphics{image}
\end{center}
\end{figure}
\end{document}
The optional automatic PSFrag commands will be created depending on parsing
the image file for (show) command lines related to
floating point numbers.
This LaTeX compiler will be valled via
<LaTeX compiler> --src -interaction=batchmode -max-print-line=120
"out.tex" "out.dvi"
and create the DVI file "out.dvi".
The DVI file will be translated to the PS file "out.ps" via the call
<DviPs> -o "out.ps" "out.dvi"
The PS file will be translated to the PDF file "out.pdf" via the call
<Ghostscript> -dBATCH -DNOPAUSE -q
-sDEVICE=pdfwrite -sOutputFile="out.pdf" -f "out.ps"
A bounding box of relevant contents of the PDF file will be
calculated by Ghostscript via
<Ghostscript> -sDEVICE=bbox -sNOPAUSE -q
-dBATCH "out.pdf"
and the related output stream parsed for the %%BoundingBox and
the %%HiResBoundingBox lines.
If both lines are found the high resolution bounding box will be used.
A second PDF file called "out_c.pdf" will be created that contains only the first PDF file's content within the bounding box. The file will be copied to the source file's directory as "<name>.pdf".