how to find PDF page count
Does anyone know where I can look in a PDF file to find the number of pages in the document?
|
The xpdf utilities package (called xpdf-utils in debian) includes an application called pdfinfo. It will print out the number of pages in the file, among other data.
You might also want to check out pdftk, which provides some useful tools for manipulating .pdf files. |
If you are opening it manually - it will be there at the foot of the Acrobat Reader application screen.
:) Linux Archive |
Try 'pdfinfo'.
|
Or pdftk, too:
Code:
pdftk file.pdf dump_data | grep NumberOfPages |
Heck, I'll join the party. My favorite way is to use a PDF to PostScript tool, like pdf2ps. (If your system doesn't have that, just install Slackware, and you'll be all set.)
Code:
pdf2ps something.pdf something.ps |
Someone suggested looking for /Count. That works, sort of ...
strings myfile.pdf | grep /Count However, some files I have tested show multiple /Count entries: /Count 1 /Count 4 /Count 1 /Count 5 /Count 1 /Count 6 In the examples I've tried, the highest number listed is the correct count. Any idea why I get multiple counts. |
Ok if you want just the number of pages do this:
Code:
pdfinfo file.pdf | grep Pages | awk '{print $2}' |
Why bother if you have other tools at hand?
Code:
$ pdfinfo file.pdf | grep Pages |
All times are GMT -5. The time now is 04:24 PM. |