What is --hires
for?
To obtain a better result when cropping a pdf image produced by PSTricks, I use --hires
option as follows
latex filename.tex
dvips filename.dvi
ps2pdf -sOutputFile=filename-temp.pdf filename.ps
pdfcrop --hires filename-temp.pdf filename.pdf
According to pdfcrop --help
shown in the following screenshot, the --hires
make pdfcrop
use high resolution bounding box (instead of the usual bounding box) to crop a pdf input.
Scenario & Problem
I am writing a book that use PDF, PNG, JPEG images and PSTricks codes. Actually xelatex
can help me to compile the input file. Unfortunately, xelatex
runs very very very slowly. The very bad performance makes me reluctant to use xelatex
.
The next candidates are pdflatex
(and context
but I am not familiar with it). Behind the scene, pdflatex
with auto-pst-pdf
package compiles each PSTrick code, converts it to PDF, crops the surrounding white space of the PDF image, and finally includes all the resulting PDF images to produce a complete document.
In this process, there is a temporary PDF file that contains a bunch of the cropped PDF images in the working directory. Unfortunately, the bounding box is not so accurate. If we see each cropped image carefully, we will notice that the left, right, top, and bottom margins are not exactly the same. Therefore, I need to pass --hires
to pdfcrop
, but I don't know how to do this.
The following code snippet might be needed for a test.
Don't forget to use
-shell-escape
or--enable-write18
when invokingpdflatex
.
\documentclass{article}
\usepackage[english]{babel}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}% I need pass --hires, but how ?
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{figure}[hbtp]
\centering
\begin{pspicture}(4,3)
\pscircle[fillstyle=solid,fillcolor=red,opacity=0.2](2,3){2}
\end{pspicture}
\caption{\label{fig:circle}This is a circle.}
\end{figure}
\blindtext
\end{document}
Question
Is it possible to force auto-pst-pdf
to use --hires
option when it internally invokes pdfcrop
?