[pdftex] Multiple references to image fails.

John Culleton john at wexfordpress.com
Tue Jun 10 14:51:58 CEST 2008


On Monday 09 June 2008 11:48:17 pm Heiko Oberdiek wrote:
> On Mon, Jun 09, 2008 at 11:55:30PM +0200, Hartmut Henkel wrote:
> > On Mon, 9 Jun 2008, John Culleton wrote:
> > > \edef\firstimage{\the\pdflastximage}
> >
> > maybe it's in a group and therefore you need \global\edef or
> > \xdef.
>
> Also he is reinventing the wheel. graphicx/pdftex.def exists,
> it also reuses the image number and also works for plain-TeX
> (with the help of miniltx.tex).
>
> Yours sincerely
>   Heiko <oberdiek at uni-freiburg.de>

I am more copying the wheel than reinventing it.  The \edef statement 
is lifted from the source for samplepdf.tex.  If the alternative you 
suggest has additonal virtues, i.e., is more robust, less verbose or 
in particular is more economical of system resources than the \edef 
option I would be glad to hear more about it.  Where is it 
documented?

Back to the current setup. Following the hints of several people I 
moved three image definitions out of an \hbox and defined them 
separately thus:
-----------------------
 \pdfximage width 2.5in{snapshot9.png} 
\edef\firstimage{\the\pdflastximage}
\pdfximage width 2.5in{snapshot6.png}
\edef\secondimage{\the\pdflastximage}
\pdfximage width 3.5in{snapshot7.png} 
\edef\thirdimage{\the\pdflastximage}
\hbox{
\pdfrefximage\firstimage 
\hskip .25in
\pdfrefximage\secondimage 
\hskip .25in 
\pdfrefximage \thirdimage }  
--------------------------------------
Moving the definitions out of the box made them global.

Now my real objective was to not only reuse \firstimage but use it at 
different sizes.  AFAIK that cannot be done without reloading the 
image.  I am trying to cut down on the number of image instances in 
the pdf file so as to restrict its size. The e-book site restricts 
total e-book size to 2mb so every byte counts.  For this reason I am 
using TeX instead of Scribus, and plain pdftex instead of Context or 
pdfLaTeX.

As always I am willing and ready to be educated further. 
-- 
John Culleton


More information about the pdftex mailing list