回复 1# 952C
请参考Q-04把test.bat文件保存为ANSI编码:
https://mp.weixin.qq.com/s/Koje4FufWxWBs7ioDy_LJA- @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 "SubFolderPDF=LastPage"
- set "SubFolderPic=PDF2Pic"
-
- cd /d "%TargetFolder%"
- md "%SubFolderPDF%" 2>nul
- md "%SubFolderPic%" 2>nul
- for /f "delims=" %%i in ('dir /b /a-d *.pdf') do (
- echo %%i
- pdftk.exe "%%i" cat r1 output "%SubFolderPDF%\%%i"
- )
-
- REM 1、下载并安装 Ghostscript 这个命令行工具
- REM https://www.ghostscript.com/releases/gsdnld.html
- REM 2、根据自己电脑实际安装路径设置以下临时环境变量
- set "path=C:\Program Files\Ghostscript\gs10.00.0\bin;%path%"
-
- for /f "delims=" %%i in ('dir /b /a-d "%SubFolderPDF%\*.pdf"') do (
- echo %SubFolderPDF%\%%i
- gswin64c.exe -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dGridFitTT=2 -dUseCropBox -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r300 -sDEVICE=jpeg -dJPEGQ=100 -sOutputFile="%SubFolderPic%\%%~ni.jpg" "%SubFolderPDF%\%%i"
- )
复制代码
|