Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - How to delete unused images from PDF?
  FAQ FAQ  Forum Search   Register Register  Login Login

How to delete unused images from PDF?

 Post Reply Post Reply
Author
Message
james.si View Drop Down
Beginner
Beginner


Joined: 19 May 06
Location: Slovenia
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote james.si Quote  Post ReplyReply Direct Link To This Post Topic: How to delete unused images from PDF?
    Posted: 19 May 06 at 1:18PM
Is there a possibility to delete unused pictures (pictures that are not drawn) from PDF? Please help.
Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 06 at 2:41PM
Don't know for sure, but here are some things you might try:

FindImages() / ReplaceImage(). Might be able to replace a big unused image with a tiny one to save space.

DeleteLayer(). Might be able to delete a layer with images, assuming they are on a layer by themselves.

CheckObjects(). Documentation just says it checks all objects to see if they're valid. Doesn't say whether it removes invalid objects, but may be worth a try.

I'm still amazed at the number of functions in this library, and haven't used them all by any means.
Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 06 at 3:10PM

I’ve tried a number of things to remove image streams from the PDF and I have not found the means within QuickPDF. I have traced the code and it looks to me as though replace image only replaces the reference to the stream not the stream object itself.  It does not look like it would be an enormous challenge to write a function capable of doing this however there may be ramifications of which I am unaware.

 

sb

Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 06 at 3:19PM
Good to know.

Meanwhile, here's a tool than definitely can remove images:

http://www.windjack.com/products/pdfcanopener.html

Unfortunately, it also requires Acrobat, so is pretty much out of my price range...
Back to Top
james.si View Drop Down
Beginner
Beginner


Joined: 19 May 06
Location: Slovenia
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote james.si Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 06 at 2:41AM
reply to chicks: I allready tryed all those things, before I was writing to this forum. I am working on PDF compresion. I replace bmp pictures in PDF with JPG but I can't remove replaced pictures.
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 06 at 3:05AM
Have you try an extractpages function after the replacement to create a new Pdf file ?
Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 06 at 3:37PM
I bought NitroPDF on sale at Fry's for $49 last week. Just tried removing an image from a sample PDF, works great! File size went from 132K to 58K.

Boxed version of NitroPDF was out of date, but updated for free with download version released just two days ago. Appears to work well so far...
Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 06 at 2:01PM
It's also possible to do this manually, if you're not shy about editing PDF files directly. You'll need the free pdftk tool.

Here's an example:

http://www.savefile.com/files.php?fid=1846963

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

The final file, step3.pdf, is now a valid, compressed PDF, without the unwanted image (we left the text description below the spot where the image was). We can now use QuickPDF to add a new image in its place.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store