Determine number of coloured PDF sheets?
do you know any way to determine the number of coloured sheets when priting a pdf file in d开发者_JAVA百科uplex-mode: The sheet counts as coloured when at least the odd or even page of one sheet contains some coloured text/image? Any method to determine accepted! Thanks!
Found this over at http://root42.blogspot.de/2012/10/counting-color-pages-in-pdf-files.html
gs -o - -sDEVICE=inkcov input.pdf | grep -v "^ 0.00000 0.00000 0.00000" | grep "^ " | wc -l
Worked well for me
Total page count can be found by
pdfinfo input.pdf | grep Pages:
If you go looking at color spaces, you can express grays in an RGB color space. Grays can result in colors in the presence of funky blending modes.
You really need to render the pages.
I suggest you use GhostScript to write all your pages to your favorite image format, then examine each pixel of each page's image to see if its a shades-of-gray, or a Color.
精彩评论