[pdftex] pdf objects with references to each other?

Robert Howlett rhowlett at mail.usyd.edu.au
Sat Mar 30 21:11:14 CET 2002


Heiko Oberdiek wrote:
> 
> On Sat, 30 Mar 2002, Robert Howlett wrote:
> 
> >   \pdfannot width 12 cm height 2 cm depth 10 pt
> >   {/Subtype /Popup
> >   /T (Algebra 1)
> >   /Open false
> >   /C [0 1 1]
> >   /Contents
> >   (Lectures given at the University of Sydney for the course
> >   Math3902.)}
> >   \pdfannot height 2 cm depth 10 pt
> >   {/Subtype /Text
> >   /C [0 1 1]
> >   /Popup \the\pdflastannot\space 0 R}%
> >
> > i.e. the T and Contents entries go into the popup
> > instead of the text annotation itself.
> > What I would have liked to do is have the T and Contents
> > entries in the dictionary of the text annotation and
> > put a Parent key in the dictionary of the popup referring
> > back to the text annotation. However, this means having
> > entries in the dictionaries of each text annotation
> > and the popup annotation referring to the other.
> > I can't figure out a way to do this with pdftex.
> > It seems to me that I need to be able to tell pdftex to
> > choose some number that has not yet been used
> > for an object, create an indirect reference to a
> > yet-to-be-constructed object with that number, and then
> > later make an object with that number.
> > Can this be done?
> 
> You can use a pdf object without referencing:
> 
> \setbox0=\hbox{Click}
> \edef\APNrule{width\the\wd0 height\the\ht0 depth\the\dp0}
> \immediate\pdfxform0
> \edef\APNobj{\the\pdflastxform}
> 
> \pdfobj{}%
> \pdfannot ... {%
>   /Subtype/Popup%
>   /Parent \the\numexpr\pdflastobj+2\relax\space 0 R%
>   /Open false%
>   /C[0 1 1]%
> }%
> \pdfannot\APNrule{%
>   /Subtype/Text%
>   /Popup \the\pdflastannot\space 0 R%
>   /C[0 1 1]%
>   /T(...)%
>   /Contents(...)%
>   /AP<</N \APNobj\space 0 R>>%
> }
> 
> Without e-TeX: \pdflastobj has to be stored in a counter
> register after \pdfobj{} and the register is then
> incremented by 2 and is used in the next \pdfannot command
> instead of \numexpr.
> 
> Yours sincerely
>   Heiko <oberdiek at uni-freiburg.de>
> 

Many thanks.
I had wondered if something like this might work, but I
was worried that something like \pdflastobj+2 could
hit upon a number that had already been used somehow,
if pdftex's method for choosing object numbers was
a bit complicated.

Bob



More information about the pdftex mailing list