回复 1# 柒叶果
获取单个pdf文件的页数.bat- @echo off
- REM 1. 下载并安装命令行工具 PDFtk Server
- REM https://www.pdflabs.com/tools/pdftk-server/
- REM 2. 请根据自己电脑实际情况设置该路径
- set "path=C:\Program Files (x86)\PDFtk Server\bin;%path%"
- REM 3. 指定待处理的pdf文件
- set "TargetFile=C:\Users\Administrator\Desktop\1.pdf"
-
- pdftk.exe "%TargetFile%" dump_data | findstr "NumberOfPages"
- pause
复制代码 获取多个pdf文件的页数.bat- @echo off
- REM 1. 下载并安装命令行工具 PDFtk Server
- REM https://www.pdflabs.com/tools/pdftk-server/
- REM 2. 请根据自己电脑实际情况设置该路径
- set "path=C:\Program Files (x86)\PDFtk Server\bin;%path%"
- REM 3. 指定待处理的pdf文件所在的文件夹
- set "TargetFolder=C:\Users\Administrator\Desktop\PDF"
-
- set "OutFile=1.csv"
- pushd "%TargetFolder%"
- >"%OutFile%" echo Filename,Pages
- for /f "delims=" %%i in ('dir /b /a-d *.pdf') do (
- echo 正在处理文件 %%i
- for /f "tokens=2" %%j in ('pdftk.exe "%%i" dump_data ^| findstr "NumberOfPages"') do (
- >>"%OutFile%" echo %%i,%%j
- )
- )
- popd
- pause
复制代码
|