[Poppler-bugs] [Bug 96529] PDFDoc::saveIncrementalUpdate() saves the trailer dict twice

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Jun 17 09:02:22 UTC 2016


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

--- Comment #6 from Jakub Kucharski <jakubkucharski97 at gmail.com> ---
(In reply to Thomas Freitag from comment #5)
> (In reply to Jakub Kucharski from comment #4)
> > A bit more reading of PDF reference and:
> > "In an incremental update, any new or changed objects are appended to the
> > file, a
> > cross-reference section is added, and a new trailer is inserted."
> > So this seems ok. Sorry for the trouble. But to make it a bit clearer: why
> > is the "0000000000 65535 f" (always) added (line 942 in poppler/PDFDoc.cc)?
> 
> You should read the spec carefully, then You will find the following
> sentence:
> 
> The first entry in the table (object number 0) shall always be free and
> shall have a generation number of 65,535;
> 
> And if You look at the code in PDFDoc.cc You will encounter that it is just
> done and then always if a new XRef() object is created to ensure this.

In this case, shouldn't line 967 in poppler/PDFDoc.cc be "if
(uxref->getNumObjects() == 1) {" instead of "if (uxref->getNumObjects() == 0)
{"? It seems to me that at this point uxref->getNumObjects() will never be 0
given the prior adding (line 942) of the first entry with generation number
65,535.

> And it seems as if You haven't understand the PDFWriteMode parameter of
> saveAs. If it is writeForceRewrite it will completely rewrite the complete
> PDF and You will find just one trailerDict and xref section, otherwise it
> uses an incremental update and just appends modified/new objects, of course
> the new trailer dict and the xref section!

That I've already understood.

Thanks for the help. And sorry for the trouble.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20160617/01b2154b/attachment.html>


More information about the Poppler-bugs mailing list