[pdftex] Reference to objects in outlines.

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sun Jan 16 14:32:53 CET 2011


On Sun, Jan 16, 2011 at 02:22:02PM +0100, Paul Isambert wrote:

> When you create a bookmark with a user action instead of a goto,
> pdfTeX stores the action in an object and refers to it in the
> outline dictionary. For instance
> 
> \pdfoutline user {<< /S/URI /URI (http://www.tug.org) >>}{Go to TUG!}
> 
> produces an object with the action dictionary:
> 
> 1 0 obj
> << /S/URI /URI (http://www.tug.org) >>
> endobj
> 
> and in the outline dictionary it refers to it:
> 
> ...
> /A 1 0 R
> ...
> 
> This is fine, except when you want to refer to an action dictionary
> you have defined yourself. Suppose for instance that object 1 was
> created independantly. I can't make \pdfoutline refer to that
> action, because it must be fed an action dictionary, not a reference
> to such a dictionary. 

Workarounds:

> The best I can do is use a unexisting named
> action (because PDF allows that) with a /Next field pointing to my
> object:
> 
> \pdfoutline user {<< /S/Named /N/NoAction /Next 1 0 R >>}{Go to TUG!}

> This works, but I find it terribly unelegant. Is there another way?

* Empty JavaScript action, "terribly unelegant" the same way as
  an unexisting named action.

* Copy the contents of your action object in the user argument.
  It might need two passes, if the contents of the action object
  is not yet known.
    Then you have at least the object semantics you really want.
  However, the object representation is not very efficient because
  of the duplicated object. But these duplicates can be removed
  by post-processing the PDF file by a stupid optimizer that does
  not know the semantics of the objects. (In the other cases above
  the optimizer would need to know that the object is an action
  and that /NoAction is not a known action and that the action
  object can therefore be replaced by the reference in /Next.)

> I.e. (I suppose) can we have chains of references in PDF, so that
> the object to which the outline points would be no more than a
> reference to another object (the action I have defined)?

An indirect object must not be a object reference.

Possible solutions at pdfTeX level:

* Syntax extension to pdfTeX:
  An action can also be an object reference, e.g.:
  <action spec> := "user" <user-action spec>
                 | "goto" <goto-action spec>
                 | "thread" <thread-action spec>
                 | "ref" <number>
  <user-action spec> := <general text>
  ...

* Alternatively the context of <user-action spec>
  is interpreted differently if the contents matches the
  pattern in Perl syntax: /^(\d+) 0 R$/.
  Then the reference with object number $1 is directly be
  used to specify the action instead of creating a new
  action object with the contents of <user-action spec>.

Yours sincerely
  Heiko Oberdiek
-- 


More information about the pdftex mailing list