Subject: | XObject missing in Acrobat (with potential fix) |
Hello,
I've been having a problem with PDF::API3 when using importpage. Acrobat
would report errors about things like "Fm1 Xobject missing".
I started investigating the difference between an original 1-page PDF and a modified 1-page
PDF that was created via importpage from the original.
What I came up with was this (I cut this up a bit, if you need more detail I can certainly
provide it, let me know):
original PDF:
..../Fm1 17 0 R....
So then I tracked down 17 0:
17 0 obj
<</BBox[-7.2959 259.2 -7.2959 259.2]/Group 36 0 R/Length 0/Matrix[1.0 0.0
0.0 1.0 0.0 0.0]/Resources<<>>/Subtype/Form>>stream^M
endstream
Then I tracked down 36 0:
36 0 obj
<</I false/K true/S/Transparency/Type/Group>>
endobj
Then I looked at the modified PDF to find the same things:
/Fm1 52 0 R
Tracking down 52 0:
52 0 obj << /Subtype /Form /Matrix [ 1.0 0.0 0.0 1.0 0.0 0.0 ] /Group 53 0
R /Length 0 /Resources << >> /BBox [ -7.2959 259.2 -7.2959 259.2 ] >>
endobj
And 53 0:
53 0 obj << /Type /Group /S /Transparency /I false /K true >> endobj
.. After manually modifying the non-working PDF and replacing "endobj"
with "stream/endstream", the document worked fine in Acrobat and reported
no errors....
So I started looking at the code and saw this in File.pm:
559 # streams can't be followed by a lone carriage-return.
560 # fredo: yes they can !!! -- use the MacOS Luke.
561 if (($str =~ s/^stream(?:(?:\015\012)|\012|\015)//o)
562 && ($res->{'Length'}->val != 0)) # stream
563 {
I removed the && ($res->{'Length'}->val != 0 and then it was able to
create the document and Acrobat did not report any errors....
If I am wrong here please accept my apologies... But, if I had to "guess", I wonder if it is
something like a rule that /Form has to have a stream? Or maybe its the presence of
/Length 0?...
Greg Saylor