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!
![]() |
Problem Splitting a File |
Post Reply
|
| Author | |
Thahn
Beginner
Joined: 26 Jul 10 Location: U.S. Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Topic: Problem Splitting a FilePosted: 28 Jun 12 at 2:00PM |
|
I have only used QuickPDF once and that was several years ago so I am a newbie. Be kind! My code outputs the correct number of pages but only the first page is correct, all others are blank. Obviously, I have something wrong in the "merge" code but I can't see it. I would also appreciate any suggestions on how to make the code more efficient. I have included the entire code snippet in case the problem is different than I think it is. QuickPDF 7.19 {CODE} const eBillIdentifier = 'EBILL'; var NewID :integer; DocID : integer; x : integer; TextContent : AnsiString; PageOut : boolean; begin PageOut := false; // get total page count QP.LoadFromFile(FileIn); DocID := QP.SelectedDocument; PageCount := QP.PageCount; // Iterate through each page in the document x := 1; while x <= PageCount do begin // look for pages that match TextContent := QP.ExtractFilePageText(FileIn, '', x, 0); if pos(eBillIdentifier, TextContent) <> 0 then begin // found one QP.ExtractPageRanges(IntToStr(x)); // save ID of input page DocID := QP.SelectedDocument; // is it the first output page? if not PageOut then begin // yes, start output document NewID := QP.SelectedDocument; PageOut := true; end else begin // merge with previous result QP.SelectDocument(NewID); QP.MergeDocument(DocID); end; end; // page wanted inc(x); end; //loop QP.SelectDocument(NewID); QP.SaveToFile(FileOut); QP.RemoveDocument(NewID); {CODE} TIA for your help, Tom |
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 02 Jul 12 at 1:35PM |
|
Here is a link to some sample code that will do what you need.
Andrew. |
|
![]() |
|
Thahn
Beginner
Joined: 26 Jul 10 Location: U.S. Status: Offline Points: 7 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 Jul 12 at 11:44AM |
|
Thank you. It works perfectly and is more faster by a factor of at least 4:1 on larger files.
Tom
|
|
![]() |
|
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