Print Page | Close Window

ExtractPageRanges

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1300
Printed Date: 24 Apr 25 at 6:33AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: ExtractPageRanges
Posted By: mhc
Subject: ExtractPageRanges
Date Posted: 29 Dec 09 at 9:41PM
I have a PDF that I need to extract certain pages out and create another pdf with just those pages.  ISED seems to have the function:

QP.ExtractFilePages Input, Output, Pages

What I am passing is this:
QP.ExtractFilePages PDFName, NewPDF, "1-2"

When I do this the NewPDF does not get created.

Any help on why this does not work?



Replies:
Posted By: mhc
Date Posted: 29 Dec 09 at 9:57PM
Update:
I got it to create the file now but it only creates 1 page correctly.  Page 1 is correct and then Page 2 is blank.


Posted By: Ingo
Date Posted: 31 Dec 09 at 5:20PM
Hi mhc!

Here you'll find all you need for your first steps:
http://www.quickpdf.org/forum/quickpdf-the-first-steps_topic1242.html

Cheers and welcome here!
Ingo



Posted By: mhc
Date Posted: 31 Dec 09 at 5:26PM
Originally posted by Ingo Ingo wrote:

Hi mhc!

Here you'll find all you need for your first steps:
http://www.quickpdf.org/forum/quickpdf-the-first-steps_topic1242.html

Cheers and welcome here!
Ingo



Thanks Ingo,
This function does not work for some of our PDF's.  I tried another PDF it works but not others.   Do you have any ideas why it would work for some PDF's but not others?  I can email you the PDF it doesn't work for if you want.


Posted By: shimax
Date Posted: 03 Jan 10 at 1:01AM

Hello mhc,

I confirmed what you have described.
It can be confirmed by simply downloading A Customizable Demo For Quick PDF Library at:
http://www.quickpdflibrary.com/blog/2009/10/a-customizable-demo-for-quick-pdf-library/ - http://www.quickpdflibrary.com/blog/2009/10/a-customizable-demo-for-quick-pdf-library/

and by editing the sample code of ExtractFilePages like below:

//QP.ExtractFilePages(GetInputFolder() + "sign_me.pdf", GetOutputFolder() + "extracted_page_range.pdf", "2-5, 8, 10, 13-19");
QP.ExtractFilePages(GetInputFolder() + "Moby_Dick_NT.pdf", GetOutputFolder() + "extracted_page_range.pdf", "2-5, 8, 10, 13-19");

sign_me.pdf works but Moby_Dick_NT.pdf does not work well and 13 pages of blank pages are produced.

And I tested with other PDF files which I have, and encountered the strange things.
Some files failed in being extracted ( error code is 409: Invalid file structure, file is damaged.) but if I copy them from C drive to F drive, they success in being extacted.
I wonder why the same files show different results.

Maybe this phenomena is because of my special environment. My OS is Japanese (But in my tests, no unicode paths are involved. ), and I develop with PHP and ActiveX.

Anyway, I think your description can be confirmed in my environment.



Posted By: DELBEKE
Date Posted: 03 Jan 10 at 10:51AM
I think the problem come with an unusual  contruction of the Pages directory in the pdf
 
Usualy, a pages directoy look like this
  1 0 obj
  <<
  /Type /Pages
  /Count 2
  /Kids [ 2 0 R 134 0 R ] 
  >>
The count entry say how much pages are defined in the pdf and the kids entry show where the pages begin
 
When a Kid entry points to another page directory, ExtrafilePage is lost
 
In the sample the page 1 entry look like this
  2 0 obj
  <<
  /Type /Page
  /Parent 1 0 R
  /MediaBox [ 0 0 612 792 ]
  /CropBox [ 0 0 612 792 ]
  /Resources <<
  /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
  /XObject <<
  /iSQPIm1fead741 133 0 R
  >>
  >>
  /Contents [ 5 0 R ]
  >>
And the second one
  134 0 obj
  <<
  /Type /Pages
  /Count 1
  /Kids [ 135 0 R ]
  /Parent 1 0 R
  >>
  endobj
 
This one is a sub-page directory and if this construction is not a bad one, it is also unusual.
 
The ExtratPageFile can't handle it.
 
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk