<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED NOTABUG - PDFDoc::saveIncrementalUpdate() saves the trailer dict twice"
href="https://bugs.freedesktop.org/show_bug.cgi?id=96529#c6">Comment # 6</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED NOTABUG - PDFDoc::saveIncrementalUpdate() saves the trailer dict twice"
href="https://bugs.freedesktop.org/show_bug.cgi?id=96529">bug 96529</a>
from <span class="vcard"><a class="email" href="mailto:jakubkucharski97@gmail.com" title="Jakub Kucharski <jakubkucharski97@gmail.com>"> <span class="fn">Jakub Kucharski</span></a>
</span></b>
<pre>(In reply to Thomas Freitag from <a href="show_bug.cgi?id=96529#c5">comment #5</a>)
<span class="quote">> (In reply to Jakub Kucharski from <a href="show_bug.cgi?id=96529#c4">comment #4</a>)
> > 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.</span >
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.
<span class="quote">> 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!</span >
That I've already understood.
Thanks for the help. And sorry for the trouble.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>