Print Page | Close Window

Extract only the first page instead off all pages

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=3323
Printed Date: 29 Sep 24 at 12:24AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Extract only the first page instead off all pages
Posted By: Mimouni
Subject: Extract only the first page instead off all pages
Date Posted: 10 May 16 at 2:06PM
Hi,
I have a strange behavior with QuickPDFNet0916x64
In a snippet code i loop through pdf pages and i try to extract them, but instead of having expected pages i have x times the first one.

for( int n = 1; n < TotalPages; n++ )
{
int extractPageSuccess = QP.ExtractPages( n, 1 );
if( extractPageSuccess == 0 )
{
log.ErrorFormat( "Unable to extract the page number {0}/{1} from the publication", n, TotalPages );
}
else
{
string pdfPageFullPath = Path.Combine( PdfLocalDirectory.FullName, index.ToString().PadLeft( 3, '0' ) + ".pdf" );
QP.SaveToFile( pdfPageFullPath );
log.InfoFormat( "extract the page number {0}/{1} from the publication", n, TotalPages );
splittedPages.Add( new FileInfo( pdfPageFullPath ) );
}
index++;
}



Replies:
Posted By: Mimouni
Date Posted: 10 May 16 at 3:32PM
we will purchase the last version of QuickPdf(v12) and we hope that will be fine


Posted By: tfrost
Date Posted: 10 May 16 at 5:02PM
I think you have missed this sentence in the manual for ExtractPages:  "If successful, the new document will be selected and the original document will be removed from memory".

So after your first extraction, does not the 'current document' become the single-page extract?


Posted By: Mimouni
Date Posted: 10 May 16 at 5:18PM
Hi tfrost,

I'm using the documentation of QuickPdf and I don't find this sentence.
The problem is that the same snippet of code worked for older version of QuickPdf and now we have trouble with him



Posted By: Ingo
Date Posted: 10 May 16 at 5:40PM
Hi Mimouni,

please read here:
http://www.debenu.com/docs/pdf_library_reference/ExtractPages.php
...and here (tfrost is right):
http://www.quickpdf.org/forum/please-help-how-to-extract-pages-from-file_topic2466.html

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: Mimouni
Date Posted: 10 May 16 at 8:59PM
Thank you Ingo,

If i understood the concept, i should re-select in momory the original pdf document
so, i must add a call of selectDocument function in the beginin of each loop?


Posted By: Ingo
Date Posted: 10 May 16 at 9:25PM
Hi,

why not use the much easier ExtractFilePages:
http://www.debenu.com/docs/pdf_library_reference/ExtractFilePages.php
...or ExtractFilePageEx?
Here you'll find alternatives easier to use:
http://www.debenu.com/docs/pdf_library_reference/PageManipulation.php



-------------
Cheers,
Ingo



Posted By: Mimouni
Date Posted: 11 May 16 at 7:57AM
@Ingo: i don't use ExtractFilePages or ExtractFilePageEx because i each iteration i must extract one page and not a range of pages
Anyway, i have used ExtractFilePages method and i've had the some bihavior


Posted By: Mimouni
Date Posted: 11 May 16 at 8:30AM
the fact of re-selecting the document inside the loop, resolve the problem but remains to be seen the memory consumption



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