--- title: 【记录】QPDF常用命令 urlname: -ji-lu--QPDF-chang-yong-ming-ling date: 2023-09-02 12:37:29 index_img: https://api.limour.top/randomImg?d=2023-09-02 12:37:29 tags: pdf --- ## 介绍 + [QPDF](https://github.com/qpdf/qpdf) 是一款开源的 PDF 操作工具。 + [GhostScript](https://ghostscript.com/releases/gsdnld.html) 是一套基于Adobe、PostScript及可移植文档格式(PDF)的页面描述语言等而编译成的自由软件。 ## 移除密码 ```powershell D:\qpdf\bin\qpdf.exe --password='A+4.3!' --decrypt '.\140802 A+外科学1-14(密码:A+4.3!).pdf' '.\140802 A+外科学1-14.pdf' ``` ## 合并文件 ```powershell D:\qpdf\bin\qpdf.exe --empty --pages *.pdf -- '140802 A+外科学.pdf' ``` ## 分割页面 ```bash qpdf --split-pages original.pdf split.pdf ``` ## 压缩大尺寸pdf + 直接用 PowerShell 运行有点小问题:[Device 'pdfwrite' requires output file](https://stackoverflow.com/questions/32355414/failed-attempt-to-compress-pdf-with-ghostscript-device-pdfwrite-requires-out) ```cmd D:\gs\bin\gswin64c.exe -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf ```