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 > General Discussion
  New Posts New Posts RSS Feed - Remove pictures from exisiting PDF file
  FAQ FAQ  Forum Search   Register Register  Login Login

Remove pictures from exisiting PDF file

 Post Reply Post Reply
Author
Message
zeras View Drop Down
Beginner
Beginner


Joined: 29 Aug 13
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote zeras Quote  Post ReplyReply Direct Link To This Post Topic: Remove pictures from exisiting PDF file
    Posted: 28 Nov 13 at 7:26PM
We have a large pdf file with many pictures and respective text for these pictures. For one reason, we don't need pictures inside pdf file.
Therefore question, whether it's possible to delete picture within pdf file to decrease file size of pdf file.
Or any other idea?
Replace pictures by dummy or decrease resolution of pictures?
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 01 Dec 13 at 5:34AM
You need to use the FindImages(), ImageCount(), GetImageID() and ClearImage() functions.

ClearImage() will replace the image with a 1x1 single transparent pixel.

Andrew.
Back to Top
zeras View Drop Down
Beginner
Beginner


Joined: 29 Aug 13
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote zeras Quote  Post ReplyReply Direct Link To This Post Posted: 02 Dec 13 at 7:15PM
Thanks, that works.
Problem is, that I don't want to delet all pictures. Can I get page number of picture first, so that I can decide to delete or not?
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 03 Dec 13 at 6:08AM
Zeras,

FindImages will find the Image Resources list for the entire PDF file.  It is a list of images.  These images can be drawn on to multiple pages and at multiple locations multiple times.  This allows PDF files to be smaller by sharing resources.  Font's can work in a similar way.  FindImages cannot report a page number because the image is just stored ready to be drawn.

So if you have Image1 in the list and it is drawn on Page 1 and Page 2 but you only want it deleted from Page1 then you will be out of luck with this approach.  

You can use a different set of QPL functions which will tell you where each image is draw and on what page.  You can also the get the ImageID and then call ClearImage.  If the image is shared though on page 1 and page 2 then the image will be cleared from both pages.

            QP.LoadFromFile("99pages.pdf", "");
            QP.SelectPage(1);

            int id = QP.GetPageImageList(0);     // Only finds images on the current page.
            int count = QP.GetImageListCount(id);

            for (int i = 1; i <= count; i++)
            {
                int type = QP.GetImageListItemIntProperty(id, i, 400);
                int width = QP.GetImageListItemIntProperty(id, i, 401);
                int height = QP.GetImageListItemIntProperty(id, i, 402);
                int bpp = QP.GetImageListItemIntProperty(id, i, 403);
                int cs = QP.GetImageListItemIntProperty(id, i, 404);

                int ImageId = QP.GetImageListItemIntProperty(id, i, 405);

                if (width == 200)
                  QP.ClearImage(ImageId);
            }


Andrew

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. AboutContactBlogSupportOnline Store