[poppler] [PATCHES] Support to save encrypted files with PDFDoc::saveAs

Fabio D'Urso fabiodurso at hotmail.it
Mon Aug 20 14:06:10 PDT 2012


On Monday, August 20, 2012 10:32:16 PM Fabio D'Urso wrote:
> --- Patches 0015-0016 -- Special handling for XRef streams and ObjStm objects
> Another category of objects in unencrypted form are XRef streams
> (each with its own xref entry). Patch 0015 marks such entries as
> Unencrypted, so that fetch can read them correctly. Note that XRef parsing
> bypasses fetch, therefore it's unaffected by this patch.
> Actually, storing XRef stream objects makes no sense in case of full
> rewrite, because we always create a new XRef table. Therefore, copied XRef
> stream objects from the original document are just a waste of space (and
> also results in currupt objects, see commit message in 0015). Therefore
> the patch also sets a "DontRewrite" flag on those objects and skips them
> in full-rewrite mode.
> 
> Another category of space-waster leaked objects are compressed object
> streams, which are currently copied in fully-rewritten documents, even
> though the objects they contain are individually written too. Patch 0016
> sets DontRewrite on ObjStm objects too.
The patches I sent in the first message take the "reparse all XRef streams
at save-time" approach proposed by Albert.

As we had planned on IRC, these are the alternative patches that make use of
an auxiliary XRef std::vector<int> member.
Now that they're done, I prefer the other ones :D but I'm posting these ones
too so you can compare them.

P.S.: Oops, I've sent a 19th patch that was not meant to be sent. It's a
tool to print info about the XRef table and to dump the objects it contains in
various formats.
I didn't mean to publish it as it needs some refinements. If you find it useful,
let me know.

Thank you,
Fabio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0015-Mark-XRef-streams-as-Unencrypted-and-DontRewrite.patch
Type: text/x-patch
Size: 4208 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120820/ba9a1a8c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0016-Mark-object-streams-as-DontRewrite.patch
Type: text/x-patch
Size: 1523 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20120820/ba9a1a8c/attachment-0001.bin>


More information about the poppler mailing list