Print Page | Close Window

remove unused objects

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3766
Printed Date: 26 Apr 24 at 10:09PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: remove unused objects
Posted By: Jake
Subject: remove unused objects
Date Posted: 25 Nov 19 at 6:52AM
Hello,

some pdf programs offers the ability to remove objects, which are not used ,but still inside the pdf file, so that the pdf file gets smaller. Can that be done with the library and if yes, how can it be done?

best regards
Jake



Replies:
Posted By: Ingo
Date Posted: 25 Nov 19 at 7:42PM
Hi Jake,

you can remove a known unused image for example but there isn't a more automatic function for this.
To remove an unsused object you should use the free cmd-tool PDFtk.

Here's a description how to do it from our member "chicks".
It's ober 13 years old but should still work:

1. Uncompress the original PDF using pdftk:
    pdftk png_example.pdf output step1.pdf uncompress

2. Edit step1.pdf (using commandline edit.exe):
    Find the object of interest, in this case 5 0 obj.
    Remove all references to this object by deleting the
    lines associated with it, including:
      /XOBJ7BC610 5 0 R
      /XOBJ7BC610 Do
      Everything between the line starting with 5 0 obj
      and endobj
    Save the edited file to step2.pdf.

3. The xref table in step2.pdf is now corrupt, so we need to fix it. We'll also recompress the PDF:

    pdftk step2.pdf output step3.pdf compress


-------------
Cheers,
Ingo



Posted By: Jake
Date Posted: 26 Nov 19 at 5:19PM
Hello,

thx for reply. But that was not the solution i hoped to get. I know various commandline tools which are able to do this, including pdftk.exe. In my eyes cpdf.exe is a good choice for optimizing a pdf.

best regards
Jake



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk