The pdftk tool “dump_data” function can be used to deliver meta information about a pdf, including the number of pages. The following command…
pdftk test.pdf dump_data | find "NumberOfPages"
…outputs the full data dump line, for example:
"Number of pages: 32"
How can I get the count value (32 in the above case) into a new variable for further processing in the bat file?
If the format of the line is fixed and matches the one you’ve shown, you could try something like this:
Outputs:
Naturally,
>testfile ECHO ...line is just for testing purposes, and theTYPE testfilepart of theFORloop should be replaced by yourpdftk test.pdf dump_data.