• TwitterFacebookGoogle PlusLinkedInRSS FeedEmail

Count Pages In Pdf Files

28.10.2019 

On Linux (and probably mac/other Unix), the following very short BASH script seems to do the trick: #!/bin/bash file='$1' for page in $(identify -density 12 -format '%p ' '$file'); do if convert '$file$((page-1))' -colorspace RGB -unique-colors txt:- sed -e 1d egrep -q -v ': ( s.(0-9.), s. 1, s. 1'; then echo $page fi done Name the script something like coloredpages.sh, and make it executable with chmod +x coloredpages.sh and then run./coloredpages.sh 'pdfname.pdf' and it should return a list of page numbers.

  1. Where Are My Pdf Downloads

You would need to write a JavaScript to perform this action. You would also need to limit this action to only the PDF type files. Fortunately Joel Geraci has provided for free PDF Portfolio Utilities: Version 1.7 that includes the ability to get a page count for the PDF files within a Portfolio. This product only works with Acrobat.

This requires ImageMagick and probably Ghostscript to be installed. And it's not the speediest thing in the world. Sorry, I have no clue how to adapt this for Windows (without Cygwin or similar, anyway). Having the same task as the OP and working in Windows, I've found the following solution to work quickly and nicely: is non-free but the evaluation version still does the job.

Download the zip file from the above link, unzip it and run bin/C#ParsingTest yourfile.pdf. You'll see something like Page 1 is BW Page 2 is Color.

Counter

Page 143 is Color Statistics: bwPageCount=99, colorPageCount=44 The mentioned in requires installation (which for my one-time job-dissertation printing) is a disadvantage. However it also does the job and provides a GUI. After installing it, run it, drag-and-drop the PDF file into it, check Color Pages Counting in Setup/Options, then click the Page count files in list button.

Where Are My Pdf Downloads

Interestingly, the results for my thesis differ by 1 page (99/44 vs. I believe, this is because some figure (I made all with Inkscape) is actually black-and-white but is described as colour in metadata. I am not sure. What I didn't find in Rapid PDF Count is a list of all colour/B&W pages, so I cannot tell the exact source of this discrepancy.