[pdftex] group object is lost if there is an xform object

Marcel Fabian Krüger tex at 2krueger.de
Fri Apr 8 00:46:02 CEST 2022


Hi,

the problem is the global variable `pdfpagegroupval` which is reset at
the beginning of the ship_out routine and shared between the node
shipout code and the image writer. Since xforms recursivly invoke xforms
between these two places they overwrite the value leading to the error.

This can be solved by making sure that images are written *before*
xforms are shipped. A patch doing this is attached. Testing so far has
been limited (it passes the LaTeX test suite, but I didn't try many
other documents). It should be rather safe though.

Best,
Marcel
-------------- next part --------------
>From 634c4b4e52e9c7e5cf781a6869ed872f1cd5900c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= <tex at 2krueger.de>
Date: Fri, 8 Apr 2022 00:22:26 +0200
Subject: [PATCH] Fix missing /Group when xforms appear on page

---
 texk/web2c/pdftexdir/pdftex.web | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/texk/web2c/pdftexdir/pdftex.web b/texk/web2c/pdftexdir/pdftex.web
index 0e06342a7..df5b82842 100644
--- a/texk/web2c/pdftexdir/pdftex.web
+++ b/texk/web2c/pdftexdir/pdftex.web
@@ -19166,10 +19166,14 @@ pdf_end_text;
 pdfshipoutend(shipping_page);
 pdf_end_stream
 
+@ We need to write forms last since the recursive call to |ship_out|
+would reset global state like |pdfpagegroupval| which is needed while
+writing images.
+
 @ @<Write out resource lists@>=
 @<Write out pending raw objects@>;
-@<Write out pending forms@>;
-@<Write out pending images@>
+@<Write out pending images@>;
+@<Write out pending forms@>
 
 @ @<Write out resources dictionary@>=
 pdf_begin_dict(pdf_last_resources, 1);
-- 
2.35.1



More information about the pdftex mailing list.