PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: How to get Number of pages in a pdf file
   PostPosted: 07 May 2014, 00:13 
Hi

I am merging existing pdf with another stream, i am able to get the pdf file, but i have an requirement where i need to include total number of pages at the end of generated pdf.
How can i get the size(no.of Pages) of an existing pdf file.

I have tried using "${total}" but this just gives the only the size of generated stream and does not include the size of existing pdf file that is merged with.


Could any one of you please give the solution .. and we are using version: PD4ML 381 Pro

Thanks in advance


  Subject: Re: How to get Number of pages in a pdf file
   PostPosted: 07 May 2014, 19:08 
If you know a number of pages of the existent PDF, you may add it as a correction to the final $[total] value with header.setInitialPageNumber():

PD4PageMark header = new PD4PageMark();
header.setInitialPageNumber(10);
header.setAreaHeight( -1 ); // autocompute
header.setHtmlTemplate( "$[total]<hr>" ); 
pd4ml.setPageHeader( header );


If a number of pages is not known for a particular case, you would need to count it with a third-party tool. Currently PD4ML Web implements the needed PDF page count functionality ( http://pd4ml.com/pd4ml_web.htm ), but the API is not exposed and documented yet.

We plan to include the new PDF manipulation module (PDF analyze, merge etc) to the main branch of PD4ML with a forthcoming release.



[Reply]     [ 2 posts ] 

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share