[pdftex] define pdf variable and then reference it?

ivo welch ivowel at gmail.com
Sat Jun 10 21:15:23 CEST 2006


unfortunately, for some odd reason, pdftk did not work for me through
a perl system() call under apache2.  go figure.  alas, I now tried
solution #1 (thanks Hartmut):

\documentclass{article}
\pdfcompresslevel=0
\newcount\XOBJA
\setbox1=\hbox{12345678909876543210123456789} % this is a special
string that one can later replace in the pdf file by hand
\pdfxform 1 \XOBJA=\pdflastxform

\begin{document}

Here is my string on page \arabic{page}: \pdfrefxform \XOBJA

\clearpage

\pdfcompresslevel=9

Here is my string on page \arabic{page}: \pdfrefxform \XOBJA

\clearpage

Here is my string on page \arabic{page}: \pdfrefxform \XOBJA

\end{document}

this works all as expected.  alas, I can confirm that in more complex
documents, a \pdfcompresslevel=9, even if issued after a \clearpage,
can apply even to a previous page that had \pdfcompresslevel=0 at
document top.  so, in the end, I need to just leave the entire
document uncompressed.  not pleasant---will put some more strain on
the server and client.  (if http only knew about compression, it would
at least save net bandwidth, though not disk space.)

I have also tried to create the XObject via pdfcatalog so that it
escaped compression, but did not succeed.  it would be nice if
pdfcompresslevel would not apply to userdefined xobjects....

regards,

/iaw


regards, /iaw

On 6/1/06, Hartmut Henkel <hartmut_henkel at gmx.de> wrote:
> On Wed, 31 May 2006, ivo welch wrote:
>
> > I have a strange question.  I would like to customize a large pdftex
> > generated document for everyone who downloads it.  For example, I
> > would like to write in the headings of each page "hello, george".
> > alas, I do not want to have to re-latex for every downloader.
> >
> > One solution would be to turn off all pdftex compression, and then
> > look for a very unusual string that I would put into the heading, and
> > which would be replaced.
>
> it's somehow possible, but ugly. E. g.
>
> \pdfcompresslevel=0
> Hello \pdfliteral direct{XYXXXXXXXXXXXXXXXXXXXXXXX}
> \vfill\eject
> \pdfcompresslevel=9
> compressed
> \bye
>
> secret is that \pdfcompresslevel can be set on a per-page basis, so only
> the 1st page would need to be uncompressed; a feature that might go
> away. Another problem is that the glyphs must be there if an embedded
> font is used. You can force this by \pdfincludechars. And you need a
> trick for making a blank before the \pdfliteral, maybe by a white
> \vrule.
>
> Regards, Hartmut
>


More information about the pdftex mailing list