[pdftex] cropping whitespace in pdfs

Hartmut Henkel hartmut_henkel at gmx.de
Thu Dec 16 19:24:41 CET 2004


On Thu, 16 Dec 2004, Kenny Chamber wrote:

> I have several small pdf documents, each with 3-15 lines of
> pdflatex-processed text followed by a link (using hyperref) to its
> relevant page in a multi-volume set of on-line reference books.  (The
> small documents appear first, to invite the users' curiosity, then if
> the user clicks, the big ships come out.)
>
> How can I trim down the dimensions of these small pdfs so they look
> more tidy?  (I want to do this in an automated way, because there are
> hundreds of them.)

maybe add a cropbox to the document, e. g. by hyperref:

\usepackage[..., pdfpagescrop={60 80 536 720}]{hyperref}

Then the text will still be put on the paper-size mediabox for correct
printing, but the reader (xpdf, acroread) will display only the cropped
area (with some added border if you want). These four dimensions lower
left x/y and upper right x/y [bp] you can calculate by various ways, e.
g. by putting your text into some box and measure its dimensions. Or by
two pdflatex runs: in the 1st run store the absolute lower left and
upper right corner positions on the page with \pdfsavepos, \pdflastxpos
and \pdflastypos into some .aux file for the 2nd run.

Regards, Hartmut



More information about the pdftex mailing list