# [NTG-pdftex] \pdfpagesresources?

Hans Hagen pragma at wxs.nl
Mon Jul 4 11:06:03 CEST 2005

Pawel Jackowski wrote:
> Hi Hans,
>
>> i'm not sure if i understand the problem, but as long as adding a top
>> level page resource does not break individual page resources it's fine
>> with me;
>
>
> The only problem is that if \pdfpageresources toks list is used as
> global (that is probably quite common) in the PDF output we get the same
> code repeated as many times as number of pages in the document.

that's no problem since you can empty the toks after a shipout

>> i need to check the pdf ref, but do resources in the /Page object
>> overload those on the /Pages one?;
>
> Resources dictionary is inheritable, but now I see that this inheritance
> is different than for page attributes like page boxes. I thought that if
> some resource can't be found in local dictionary (in /Page) it is
> searched in parent node (/Pages). It seems I was wrong; the following
> produce a corrupted PDF:
>
> \immediate\pdfobj{<</Type /ExtGState /CA 0.3 /ca 0.3>>}
> \edef\A{/GS1 \the\pdflastobj\space0 R}
> \immediate\pdfobj{<</Type /ExtGState /CA 0.7 /ca 0.7>>}
> \edef\B{/GS2 \the\pdflastobj\space0 R}
>
> \edef\next{\pdfpagesattr{/Resources << /ExtGState <<\A>> >>}}\next
> \edef\next{\pdfpageresources{/ExtGState <<\B>>}}\next
>
> \pdfliteral{/GS1 gs}blah
> \pdfliteral{/GS2 gs}blah
>
> \end
>
> It seems that /Resources dict is inherited from /Pages ONLY if there is
> NO local /Resources dict in /Page object. If resource dict is empty, it
> means that the page requires no resources.
>
> Since pdfTeX always produce /Resources dictionary for each page, the
> \pdfpagesresources makes no sense. Sorry for noise.

i guessed as much -)

it's made even more fuzzy by the fact that the specs say that some resources are
optional but omitting them makes acrobat crash; another thing to keep in mind is
that they keep changing the specs (take multiple entries: currently i think that
the first one takes precedence, but in the past it has been the last; this means
for instance that careless use of \pdfinfo leads to different behaviour, in
itself not harmfull, but it may be worse when we deal with resources and such);
best leave that part of pdftex untouched.

Hans

-----------------------------------------------------------------