Faster counting pages in PDF (Was: Re: [reportlab-users] Recounting pages in PDF)

Jerome Alet reportlab-users@reportlab.com
Sat, 19 Jun 2004 10:36:53 +0200


Hi,

On Sat, Jun 19, 2004 at 02:26:20AM +0200, Matej Pivoluska wrote:
> Ask for more speed :-)
> 
> compile with 
> flex pdfcount.lex && gcc lex.yy.c -O2 -ll -o pdfcount
> 
> and use
> ./pdfcount <file.pdf
> or
> ./pdfcount file.pdf
> ...
> %%
> "/Type /Page " ++num_pages;
> [\n\t ]+
> . 
> %%

In fact from what I can see (not looked at the PDF spec), you can 
have \r and/or \n just after the /Page with no space between, so 
maybe you should add it (or replace \t, I don't know if \t is valid, 
at least I've never seen it) 

anyway this is a really cool idea !

bye, and thanks for your help

Jerome Alet