Page 1 of 1

Batch - count pages pdf File

Posted: 11 Oct 2013 09:50
by Basole
Hi guys, it is possible that one batch count the number of pages from a PDF file?

Re: Batch - count pages pdf File

Posted: 11 Oct 2013 10:11
by npocmaka_
Off course it is.Despite it's in binary format some of the metadata is in plain text:

Code: Select all

for /f "tokens=4 delims=/^< " %P in ('type Burov.pdf^| find "<</Type/Pages/Count"') do echo %P

in batch file you'll need to double the %-es.

the metadata that contains page numbers starts with <</Type/Pages/Count and it can be displayed with type command.
I'll need a little bit more testing to handle different cases e.g. spaces between words.Probably a little bit more sophisticated FINDSTR expression.

But... Probably wont be able to handle all the cases...PDF metada format is too flexible.

Re: Batch - count pages pdf File

Posted: 11 Oct 2013 14:35
by Basole
Ok npocmaka_, tks. :D