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 - Please Help How to Extract Pages from File
  FAQ FAQ  Forum Search   Register Register  Login Login

Please Help How to Extract Pages from File

 Post Reply Post Reply
Author
Message
alinux08 View Drop Down
Team Player
Team Player


Joined: 20 Jun 12
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote alinux08 Quote  Post ReplyReply Direct Link To This Post Topic: Please Help How to Extract Pages from File
    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
Back to Top
Wheeley View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Oct 05
Location: United States
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote Wheeley Quote  Post ReplyReply Direct Link To This Post Posted: 04 Dec 12 at 8:49AM
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
Back to Top
alinux08 View Drop Down
Team Player
Team Player


Joined: 20 Jun 12
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote alinux08 Quote  Post ReplyReply Direct Link To This Post Posted: 06 Dec 12 at 2:22AM
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.
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