I use the same pdf graphic many times and would like to avoid specifying a viewport in every instance. If the graphic changes, I'd have to redo all these. I created a .bb file, but this is mostly useless with .pdf files. What a drag.
So, I'm interested in a solution that avoids retyping the viewport when I change the source graphic. Preferrably a solution that uses some external file (like .bb) so I don't have to change my .tex file at all.
Here's an example that shows the problem:
Code: Select all
% Comments start with the % character
\documentclass{article}
\usepackage[hiresbb]{graphicx}
\begin{document}
% this one works, no bb file
\begin{figure}[ht]
\setlength\fboxsep{0pt}
\fbox{ \includegraphics[width=1in, viewport=25.877109 204.315111 79.269959 252.823984]{spiral_1_nobb.pdf}}
\end{figure}
% this one works, bb file and viewport
\begin{figure}[ht]
\setlength\fboxsep{0pt}
\fbox{\includegraphics[width=1in,viewport=25.877109 204.315111 79.269959 252.823984]{spiral_1.pdf}}
\end{figure}
% misplaced graphic, bb file only
\begin{figure}[ht]
\setlength\fboxsep{0pt}
\fbox{\includegraphics[width=1in]{spiral_1.pdf}}
\end{figure}
\end{document}
Code: Select all
%%BoundingBox: 25 204 80 253
%%HiResBoundingBox: 25.877109 204.315111 79.269959 252.823984