Why doesn't saving with "remove_unused" result in a smaller file after deleting pages?

31 views
Skip to first unread message

Aaron

unread,
Jul 25, 2014, 5:35:03 PM7/25/14
to pdfne...@googlegroups.com
Q:

I have ran into an issue performing page removal.

Your webpage states that "The page and its resources are still available until the document is saved in 'full save mode' with the 'remove unused objects' flag".

So I use doc.PageRemove(it) and then save the document using
doc.Save(targetFile, SDFDoc.SaveOptions.e_remove_unused)

PDFNet's output is only few kilobytes smaller than the input.

-----------------

A:

The document isn't reducing in size because the pages are still being referenced by parts of the document, namely the bookmarks and logical structure.  You can remove these references by erasing them from the document:

PDFDoc.GetRoot().Erase("Outlines");
PDFDoc.GetRoot().Erase("StructTreeRoot");

With these values removed, saving the document with "remove unused" set results in significantly smaller output.


Reply all
Reply to author
Forward
0 new messages