Ricardo Coutinho wrote: > Hi all, > > > > Currently I use the following code to get the number of pages for a PDF….. > > > > …. > > documentReader = new PdfReader(document.getData()); > > documentReader.getNumberOfPages(); > > … > > > > What I want to know is; Is there a quicker way to get this information? > Part of the processing in my application involves getting the number of > pages for a pdf and profiling my application reveals that I spend a lot > of time in the above lines….. > > > > Thanks for your comments/suggestions. > > > > Ricardo
I am fairly new to iText - so this might be untrue: Try to get a pool of 10 pdfs with different page-numbers. 1.pdf (1 page), 2.pdf (2 pages) etc... Try to find out if the information about the number of pages is always at the same place in the data-stream of that files. If that's so, you can always "parse" that value from an InputStream by just reading those bytes. It would be wise to read some Adobe PDF Reference material - it should be written there where the number-of-page info is stored. Good luck, jago _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
