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 - Count bookmarks using DAOpenFile
  FAQ FAQ  Forum Search   Register Register  Login Login

Count bookmarks using DAOpenFile

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


Joined: 11 Apr 12
Location: The Netherlands
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote modderkolk Quote  Post ReplyReply Direct Link To This Post Topic: Count bookmarks using DAOpenFile
    Posted: 11 Apr 12 at 9:50AM
Hi,

I use DAOpenFile for getting the number and format of all pages of the PDF. That works very fine, also with very big files and page formats!Clap

But sometimes I need to count the number of the bookmarks (outlines).

I know that I can use .LoadFromFile and then .PageCount() and .OutlineCount(), but then after loading several files the .LoadFromFile gives fileHandle 0. Cry
I use for each document when I am ready .RemoveDocument().

2 questions:
1. Is there or will there become a "DA-version" of the OutlineCount() ?
2. If not, what need I to do to get the OutlineCount() without problems?

Thanks,
Evert-Jan
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 11 Apr 12 at 10:15AM
Hi Jan!

Could it be that you're working on a list of files in a loop
with LoadFromFile?
Perhaps (with very large files) you throw a second filename
into LoadFromFile but the first file still isn't completely loaded?
Perhaps you should think in this direction...?
If you're suggesting a further development of QuickPDF you
should enter this Link:
http://www.quickpdflibrary.com/support/support-query.php

Cheers and welcome here,
Ingo


Edited by Ingo - 11 Apr 12 at 10:17AM
Back to Top
modderkolk View Drop Down
Beginner
Beginner


Joined: 11 Apr 12
Location: The Netherlands
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote modderkolk Quote  Post ReplyReply Direct Link To This Post Posted: 11 Apr 12 at 10:42AM
Hi Ingo,

I indeed use a loop to process a list of PDF files. For each file a call this function:

        // QuickPDF 
        private string HandlePDF(string filename)
        {
            try
            {
                int formaatNr = 0;
                // Open the file, get a file handle
                int fileHandle = 0;
                fileHandle = qp.LoadFromFile(filename, "");

                if (fileHandle == 0)
                {
                    return filename + ": cannot open file.\r\n";
                }
                int aantalPags = qp.PageCount();

                if (aantalPags == 0)
                {
                    qp.RemoveDocument(fileHandle);
                    return filename + ": filehasn't pages.\r\n";
                }
                aantalBMs += qp.OutlineCount();

                for (int p = 0; p < aantalPags; p++)
                {
                    // Get a reference to the first page and get the formats
                    int pageReference = 0;
                    double pageWidth = 0;
                    double pageHeight = 0;
                    int rotation = 0;

                    pageReference = qp.SelectPage(p + 1);
                    pageWidth = qp.PageWidth();
                    pageHeight = qp.PageHeight();
                    rotation = qp.PageRotation();

                    if (rotation == 90 || rotation == 270)
                    {
                        double d = pageWidth;
                        pageWidth = pageHeight;
                        pageHeight = d;
                    }
                    double br = pageWidth;
                    double hg = pageHeight;
                    br = br * 0.3527;  // convert from units to mm
                    hg = hg * 0.3527;
                }

                // Close the file
                qp.RemoveDocument(fileHandle);
            }
            catch (Exception ex)
            {
            }
            return "";
        }

Is this the correct way, or how can I know that a file is loaded?

Thanks,
Evert-Jan
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 11 Apr 12 at 1:03PM
Hi Jan!

If LoadFromFile returns with value 0 you can use
LastErrorCode to check where's the real problem:
http://www.quickpdflibrary.com/help/quickpdf/LastErrorCode.php

Cheers, Ingo
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