Print Page | Close Window

DPLFindImages on Only One page

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2966
Printed Date: 04 May 24 at 12:54PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DPLFindImages on Only One page
Posted By: pinya
Subject: DPLFindImages on Only One page
Date Posted: 07 Sep 14 at 12:03PM
Hello,

I need to enumerate images on only one page. How can I do it?




Replies:
Posted By: AndrewC
Date Posted: 15 Sep 14 at 3:13PM

pinya,

I have modified the code sample to load only page 1 but the loop is commented out that processes all pages.

            QP.LoadFromFile("mypdf.pdf", "");
  
            //for (int p=1;p<=QP.PageCount();p++)    // Process all pages.

            int p = 1;    // Process only page 1.
            {
                QP.SelectPage(p);

                int id = QP.GetPageImageList(0);
                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);
                    
                    double x1 = QP.GetImageListItemDblProperty(id, i, 501);
                    double y1 = QP.GetImageListItemDblProperty(id, i, 502);
                    double x2 = QP.GetImageListItemDblProperty(id, i, 505);
                    double y2 = QP.GetImageListItemDblProperty(id, i, 506);

                    double DPIx = width / (x2-x1) * 72.0;

                    switch (type)
                    {
                        case 1:
                            QP.SaveImageListItemDataToFile(id, i, 0, "temp_p" + p.ToString() + "i_" + i.ToString() + ".jpg");
                            break;
                        case 2:
                            QP.SaveImageListItemDataToFile(id, i, 0, "temp_p" + p.ToString() + "i_" + i.ToString() + ".bmp");
                            break;
                        case 3:
                            QP.SaveImageListItemDataToFile(id, i, 0, "temp_p" + p.ToString() + "i_" + i.ToString() + ".tif");
                            break;
                    }

                    //MessageBox.Show(type.ToString());
                }
            }

Andrew.



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