Get number of pages in a pdf using a cmd batch file

前端 未结 7 711
深忆病人
深忆病人 2021-02-01 01:37

I can see there are a lot of questions for getting the number of pages in a a pdf with C, PHP and others but am wondering with a batch file or cmd is there a simple way of getti

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 01:52

    It might be helpful for new users. In the new version of PDFtk tool (above 2.0), use below command to get the number of pages of a PDF file:

    pdftk file.pdf dump_data_annots output outputfile.txt
    

    A new file will created at destination having content similar to below:

    NumberOfPages: 6
    

    Now read the file and manipulate the content as you want.

提交回复
热议问题