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!
![]() |
Count bookmarks using DAOpenFile |
Post Reply ![]() |
Author | |
modderkolk ![]() Beginner ![]() Joined: 11 Apr 12 Location: The Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() 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! ![]() 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. ![]() 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
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
modderkolk ![]() Beginner ![]() Joined: 11 Apr 12 Location: The Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
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
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store