Number of pages in PDF

Number of pages in PDF


Does any one have a way of getting the number of pages in a PDF file?
I'm digitally signing the file and I need to put the image of the signature in the last page.

Any ideias are wellcome! :)

Hermínio Mira
Idea 1:
how about appending the last page a s a different page?
(thus combining 2 pdfs effectively? )

Idea 2:
If you use html2pdf perhaps you can make advantage of a custom footer.
After all it is in html.
( :: Footers And Headers )
there is an example how they add a page from/to with js.
you just add an extra check if it's the last page you inject your image?

Thanks for the reply Joost,

Idea 1: not possible, if I merge a signed PDF with another it will lose its signature, because in good truth it will no longer be the pdf that was signed.

Idea 2: I can't go with this, I really need to do this on the actual pdf. Also I'm not using html2pdf :(

What I really need is something that I pass the binary into and it returns to me the number of pages in it.

Best regards
Hi Hermínio,

I already had to work with PDFs in the past and I advise the use of the iTextSharp library.
It's a library written in C # and no doubt the best choice at no cost and a large community with examples and documentation.
You can get it here :

I did a quick console application to show you the feature you need:

With this you can create an extension in the Integration Studio to do the task.

Hope this helps..

Best Regards