[Tex/LaTex] The perfect pdfcrop

bounding boxcroppdfcropstandalone

I need a "perfect" pdfcrop, one that crops exactly to the edge of the figure or text for alignment issues as a graphic in other programs. I'm aware of the standalone package, and have gone through all the questions on pdfcrop including the --hires option. Neither solution crops to exactly to the edge. For example, using standalone:

\documentclass[crop]{standalone}
\begin{document}
Hi
\end{document}

enter image description here

and using pdfcrop --hires:

enter image description here

As you can see, pdfcrop is close, but I need something exact. I think that standalone only knows the width given by the glyphs and pdfcrop gets its information from gs. Is it possible to achieve a perfect crop using LaTeX or any external tool?

Best Answer

To be able to crop a vector graphic reliably you must "print" it to see where the black dots are.

"Printing" always involves a resolution: the black dots must have a positive size.

pdfcrop uses the bbox device of ghostscript. According to the documentation of ghostscript the default resolution of this device is 4000 dpi.

You can change this resolution but simply enlarging it doesn't mean that you get a more "perfect" result: To be able to decide if a crop is "perfect" you must "print" it e.g. to a screen to see where the black dots are and on the lower resolution of the screen you will see your "exact" crop only at a very large zoom.

Related Question