[pdftex] Simple (?) question about \pdfobj

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sun Mar 6 11:37:11 CET 2011

On Sat, Mar 05, 2011 at 08:57:56PM -0500, Duncan Murdoch wrote:

> On 11-03-05 7:01 PM, Heiko Oberdiek wrote:

> >For easier parsing, storing the string as text stream has the
> >advantage that the string quoting is omitted.
> >
> >\begingroup
> >   \pdfobjcompresslevel=0 %
> >   \pdfcompresslevel=0 %
> >   \immediate\pdfobj stream{Hello World}%
> >   \xdef\ObjectRefHello{\the\pdflastobj}%
> >\endgroup
> >
> >And the object should be anchored somewhere, e.g.:
> >   \pdfcatalog{/hello \ObjectRefHello\space 0 R}
> Just one more question:
> are /hello and \ObjectRefHello both names that I'm free to choose


> (presumably avoiding clashes with names other people choose), or is
> "ObjectRef" significant?


\ObjectRefHello can be replaced by other TeX macro name.
/hello is a PDF name, see PDF specification.
Arbitrary text can be converted to a name using
Or \EdefEscapeName from package pdfescape can be used,
see the example \EdefEscapeString in one of my previous posts.
But in your case you can avoid escaping by using a name that
does not require it.

Yours sincerely
  Heiko Oberdiek

More information about the pdftex mailing list