# [pdftex] Clipping graphics

Stéphane Mancini stephane.mancini at inpg.fr
Fri Sep 13 12:51:19 CEST 2002

Hi all,
I would like to know why, while clipping a pdf page to view
only a part of it, the whole page is kept in the produced pdf.
I don't know if I'm clear (maybe my english), but the point is
that I've wrote a script file to crop pdf using pdftex.
My script generates a latex file with the line :

\includegraphics[page={\$page},height=\paperheight,viewport=\$region,clip]{\$1}

before that, I set the page width to the size of the image to get a
nice bounding box :

\documentclass{article}
\usepackage{calc}
\setlength{\paperwidth}{\${xl}bp}
\setlength{\paperheight}{\${yl}bp}
\setlength{\textwidth}{\${xl}bp}
\setlength{\textheight}{\${yl}bp}
\hoffset         -1in
\voffset         -1in
\topmargin       0pt
\oddsidemargin   0pt
\marginparwidth   0pt
\topskip 0pt
\usepackage[pdftex]{graphicx}
\graphicspath{{\$cc/}{.}}
\DeclareGraphicsExtensions{.pdf}

\${xl} etc is from my script ....

then I run pdflatex to produce the crop.
The fact is that the produced pdf includes the whole pdf code
of the complete page !!! It can result in large files if there are
pictures of something else completerky useless for me.
Is there a way not to embed the whole page and just keep what's in the
viewport ?

Stéphane

+--------------------------------------------------+
|Stéphane Mancini   Maître de Conférence ENSERG/LIS|
|Tél : 04 76 57 43 58 Fax : 04 76 57 47 90         |
|46, Av Felix Viallet 38031 Grenoble (France)      |
|Email : stephane.mancini at inpg.fr                  |
|Page web : http:www.lis.inpg/pages_perso/mancini  |
+--------------------------------------------------+