On 3/19/2018 12:58 PM, Alexander Grahn wrote:
On 3/19/2018 11:52 AM, Hans Hagen wrote:
On 3/19/2018 11:20 AM, Alexander Grahn wrote:
Dear all,
it seems that I discovered a bug in connection with nested Form XObjects
(pdftex built-in \pdfxform) that occurs in pdfTeX as well as in LuaTeX.
The \pdfxform built-in provides the optional `resources {<resources>}'
argument, as in
\pdfxform resources {<resources>} <box>
, in order to allow the user to insert additional entries in the /Resources
dictionary of the Form XObject to be produced from box register <box>.
This works as advertised for ordinary box content (1st \pdfxform in the code
below), but as soon as another Form XObject is referenced inside <box>, the
`resources {...}' argument is ignored and user-provided <resources> are missing
in the generated PDF code (2nd \pdfxform).
Here is a minimal example for pdfTeX and LuaTeX for demonstration. The PDF
object numbers mentioned in the comments are different in the PDF output from
LuaTeX.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bug: When nesting Form XObject reference in <box>,
% \pdfxform resources {<resources>} <box>
% --> missing user-provided <resources>
\input luatex85.sty
\pdfcompresslevel=0
\pdfobjcompresslevel=0
\setbox0=\hbox{World}
\edef\wrldwd{\the\wd0}
\pdfxform
attr {}
resources {/Properties <</Key1 (Val1)>>} % OK
0
%nesting Form XObject reference
\setbox0=\hbox{Hello \hbox to \wrldwd {\pdfrefxform\pdflastxform\hss}!}
\pdfxform
attr {}
% /Properties <<...>> missing in /Resources dict (object `8 0'), ref'ed in
resources {/Properties <</Key2 (Val2)>>}% Form XObject (object `2 0')
0
\pdfrefxform\pdflastxform
\bye
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
there is no nesting stack kept there ...
\immediate\pdfxform ...
works ok
Hans
That is strange, as for `attr {...}' such a stack apparently exists.
`resources {...}' should behave in the same way.
resources are more complex as they also need to merge with others ...
it's something we will ook into but don't expect changes too soon as
we're in texlive code freeze mode
Consider this:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bug: When nesting Form XObject reference in <box>,
% \pdfxform resources {<resources>} <box>
% --> missing user-provided <resources>
\input luatex85.sty
\pdfcompresslevel=0
\pdfobjcompresslevel=0
\setbox0=\hbox{World}
\edef\wrldwd{\the\wd0}
\pdfxform
attr {/UserDict <</K1 (V1)>>} %OK
resources {/Properties <</Key1 (Val1)>>} % OK
0
%nesting Form XObject reference
\setbox0=\hbox{Hello \hbox to \wrldwd {\pdfrefxform\pdflastxform\hss}!}
\pdfxform
attr {/UserDict <</K2 (V2)>>} %OK
% /Properties <<...>> missing in /Resources dict (object `8 0'), ref'ed in
resources {/Properties <</Key2 (Val2)>>}% Form XObject (object `2 0')
0
\pdfrefxform\pdflastxform
\bye
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Alexander
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------