CC: | Ext-Antti.Lankila [...] itella.com |
Subject: | importpage with empty page |
[Received via E-Mail]
Hey,
I noticed that PDF::API2 sometimes generates this error “page not opened
via openpage” which occurs when an empty page is being read with
my $xo = $target->importPageIntoForm($source, $n).
The problem is that empty pages do not always appear to have a Contents
stream, and as consequence openpage doesn’t flag them as “fixed”, and
that then causes this error to raise when the page is being processed later.
We were able to workaround the problem by testing the presence of the
“Contents” in the object returned by $target->openpage($n), and manually
generating empty pages for those pages in the output PDF. It’d be nice,
however, if this could be fixed in openpage(): perhaps openpage should
unconditionally set “ fixed” to true, and add some placeholder Contents
stream if there is no stream already, or maybe the “die” test could be
just removed.
Antti