Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just received a pdf textbook comprised of some 20 separate pdfs (by chapter) with quasi-regular names. Is there a way for counting the pages in th book w/o openning each file (or going through the properties)?

[solution can be for Windows or Ubuntu]

share|improve this question
    
Do you have Adobe Acrobat? –  wizlog Mar 22 '12 at 16:34
add comment

4 Answers 4

up vote 4 down vote accepted

Using pdfinfo this is the best I could come up with: To print the number of pages per file:

for i in *.pdf; do echo $i && pdfinfo "$i" | grep "^Pages:"; done

To print the sum of all pages in all files:

for i in *.pdf; do pdfinfo "$i" | grep "^Pages:"; done | awk '{s+=$2} END {print s}'

On Ubuntu, pdfinfo is contained in the package poppler-utils. To install it, use:

sudo apt-get install poppler-utils

On Windows, you can use cygwin. pdfinfo is contained in the package poppler.

share|improve this answer
    
This is perfect! –  ysap Mar 22 '12 at 17:22
    
+1 pdfinfo is exactly what I was looking for. I need it for page counts in my duplex printing emulation package. –  Joe Mar 12 '13 at 6:18
add comment

In Adobe Acrobat Pro, go to file > create PDF > merge files into a single PDF. Then add files and select the files you want. Click combine, and see how many pages are in the final PDF.

share|improve this answer
    
Thanks @wizlog - this really requires the full featured (and expensive) software, doesn't it? –  ysap Mar 22 '12 at 17:26
    
Just noticed your comment on the question. No, I don't have it. –  ysap Mar 22 '12 at 17:28
add comment

Hi dont know how you can do it on windows but on linux bash it should work with this

PDFS=`ls *.pdf`
counter=0
for i in $PDFS
do
   (( counter += `pdfinfo internship_report.pdf | sed -n 's|Pages:[^0-9]*\([0-9]*\).*|\1|p'`))
done
echo $counter

best reguards kenny

share|improve this answer
    
Thanks, Kenny. This may work if the filename would scan through the files. Upvoted anyway. –  ysap Mar 22 '12 at 17:25
add comment

I know its too late but I just found a way better and simpler solution for this.

Download and install from sourceforge "pdf split and merge"

Drop all your files on it, and in the screen it generates a spreadsheet-like report on the number of pages and info of each.

Select that, copy, paste into excel or opencalc, you got it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.