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!
Please Help How to Extract Pages from File |
Post Reply |
Author | |
alinux08
Team Player Joined: 20 Jun 12 Status: Offline Points: 20 |
Post Options
Thanks(0)
Posted: 02 Dec 12 at 4:33AM |
Here are my code take from the sample:
string fileName = @"..\..\Test Files\sample1.pdf"; string OutputFile3 = @"..\..\Test Files\sample1_extracted3.pdf"; string OutputFile4 = @"..\..\Test Files\sample1_extracted4.pdf"; // Check to see if the library has been successfully unlocked if (qp.Unlocked() == 1) { int docID = qp.LoadFromFile(fileName, ""); int extractPageSuccess = qp.ExtractPages(1, 2); if (extractPageSuccess == 0) { MessageBox.Show("Page(s) could not be extracted."); } else { qp.SaveToFile(OutputFile3); } extractPageSuccess = qp.ExtractFilePages(fileName, "", OutputFile4, "1-1"); //or extractPageSuccess = qp.ExtractPages(1, 1); if (extractPageSuccess == 0) { MessageBox.Show("Page(s) could not be extracted."); } else { qp.SaveToFile(OutputFile4); } qp.RemoveDocument(docID); } My problem is that the second call of ExtractFile will always save the same pages from the first call. Is this a bug or by design? I was trying to extract some different pages by each call to ExtractFile, just can not get the job done. Or I have to close file, reopen it to extract a different range of pages? Thanks Mark |
|
Wheeley
Senior Member Joined: 30 Oct 05 Location: United States Status: Offline Points: 146 |
Post Options
Thanks(0)
|
That is because you are overwriting the pages from ExtractFilePages with the pages from Extractpages. Remove the second call to SaveToFile, run your code, and then do a compare. Then ask your self this, "Why am I saving a second time?"
Wheeley |
|
alinux08
Team Player Joined: 20 Jun 12 Status: Offline Points: 20 |
Post Options
Thanks(0)
|
Thanks. The idea is splitting the file into several small files, so what I did is calling the ExtractPage with different page ranges, and saving them after each call. Actually, after each call, the file is reloaded, it does gives me the right pages to save.
|
|
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