After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 614740 - evince 2.28.2 fails to save PDF form data properly when PDF has object streams
evince 2.28.2 fails to save PDF form data properly when PDF has object streams
Status: RESOLVED DUPLICATE of bug 611482
Product: evince
Classification: Core
Component: PDF
2.28.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-04-03 14:01 UTC by Jay Berkenbilt
Modified: 2010-04-04 13:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
original PDF file (67.56 KB, application/pdf)
2010-04-03 14:01 UTC, Jay Berkenbilt
Details
form1 with saved form data: file is correct (72.34 KB, application/pdf)
2010-04-03 14:02 UTC, Jay Berkenbilt
Details
form converted by qpdf to contain object streams (51.91 KB, application/pdf)
2010-04-03 14:03 UTC, Jay Berkenbilt
Details
file with form data as saved by evince 2.28.2 (57.24 KB, application/pdf)
2010-04-03 14:03 UTC, Jay Berkenbilt
Details
saved file after manual repair in a text editor (57.24 KB, application/pdf)
2010-04-03 14:04 UTC, Jay Berkenbilt
Details

Description Jay Berkenbilt 2010-04-03 14:01:22 UTC
I haven't tried reproducing this in a newer version of evince (since my debian unstable system has gnome 2.28), but the problem is easy to reproduce and test.

evince saves PDF form data by appending to the PDF, which is a perfectly valid way to do it, but it makes a few mistakes in appending to the file when object streams are used.  The effect is that the resulting file loads into evince without the form data, and Adobe Reader can't open the file at all.  This bug report uses qpdf (http://qpdf.sourceforge.net) to check and manipulate the PDF file.  qpdf is available in Debian and Ubuntu or can be downloaded from sourceforge.  It has only pcre and zlib as external dependencies.

The first attached pdf file (form1.pdf) can be downloaded from here:

http://www.soest.hawaii.edu/gg/isotope_biogeochem/Samplerequest.htm

This file contains no object streams even though it is a PDF 1.5 file.  Filling in the form and saving it works fine.  The resulting file is appended, and the /Size field of the trailer dictionary is set properly to 1 more than the highest numbered object.  Everything is fine.  The file is attached as form1-saved.pdf.

Now consider the same file with object streams.  You can get this with

qpdf --object-streams=generate form1.pdf form2.pdf

This time, there are several problems.  For one thing, the /Size field in the new trailer dictionary is wrong: it is equal to the highest object number instead of one above it.  If you run qpdf --check form2-saved.pdf, you get

WARNING: /home/ejb/Documents/form2-saved.pdf: reported number of objects (237) inconsistent with actual number of objects (238)

When you open the file with evince, you get lots of errors about referencing invalid or non-existent objects, and the file opens without the form data.  This happens even if you manually edit the file to change /Size to 238.

The xref table is also pretty messed up.  The generation numbers look to be the original object stream offset values from the original PDF.  In form2-saved.pdf, observe lines like

0000053156 00064 n

in the xref table and corresponding objects like 66 64 obj.  If you manually change all the generation numbers to 0 in both the xref table and in the PDF file themselves, the file is now correct and the saved form data is now accessible.

So whatever is generating the append data needs to be updated to support object streams and understand the meanings of the fields in the xref stream, apparently.

My manually repaired file is form2-fixed.pdf.

I will attach the five pdf files momentarily.
Comment 1 Jay Berkenbilt 2010-04-03 14:01:48 UTC
Created attachment 157813 [details]
original PDF file
Comment 2 Jay Berkenbilt 2010-04-03 14:02:21 UTC
Created attachment 157814 [details]
form1 with saved form data: file is correct
Comment 3 Jay Berkenbilt 2010-04-03 14:03:35 UTC
Created attachment 157815 [details]
form converted by qpdf to contain object streams
Comment 4 Jay Berkenbilt 2010-04-03 14:03:58 UTC
Created attachment 157816 [details]
file with form data as saved by evince 2.28.2
Comment 5 Jay Berkenbilt 2010-04-03 14:04:27 UTC
Created attachment 157817 [details]
saved file after manual repair in a text editor
Comment 6 Carlos Garcia Campos 2010-04-04 13:27:45 UTC
Jay, thank you very much for the so detailed bug report, this looks like a duplicate of bug #611482. It's not actually an evince issue, but a poppler bug. I've just forwarded it to freedesktop bugzilla:

https://bugs.freedesktop.org/show_bug.cgi?id=27450

Thanks!Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 611482 ***