PDF Office Toolkit
PDF办公全能工具,覆盖日常办公中PDF处理的全部常见需求。
核心能力
- 合并与拆分 - 多PDF合并为一个、按页拆分、按书签拆分
- 内容提取 - 提取文字、图片、表格数据
- 格式转换 - PDF转Word/Excel/图片/HTML
- 页面操作 - 旋转、删除、插入、提取指定页
- 水印与页码 - 添加文字/图片水印、添加页码
- 加密解密 - 设置打开密码、权限密码、移除密码
- OCR识别 - 扫描件文字识别(中英文)
- 压缩优化 - 降低PDF文件体积
快速开始
合并PDF
python3 scripts/pdf_ops.py merge file1.pdf file2.pdf -o merged.pdf
拆分PDF
python3 scripts/pdf_ops.py split input.pdf --pages 1-3,5,7-10 -o split/
提取文字
python3 scripts/pdf_ops.py extract-text input.pdf -o text.txt
添加水印
python3 scripts/pdf_ops.py watermark input.pdf --text "机密文件" -o watermarked.pdf
旋转页面
python3 scripts/pdf_ops.py rotate input.pdf --degrees 90 -o rotated.pdf
添加页码
python3 scripts/pdf_ops.py page-number input.pdf -o numbered.pdf
PDF转图片
python3 scripts/pdf_ops.py to-images input.pdf -o images/
加密PDF
python3 scripts/pdf_ops.py encrypt input.pdf --password 123456 -o encrypted.pdf
解密PDF
python3 scripts/pdf_ops.py decrypt encrypted.pdf --password 123456 -o decrypted.pdf
OCR识别
python3 scripts/pdf_ops.py ocr input.pdf -o ocr_result.txt
依赖安装
pip install PyPDF2 pdfplumber Pillow reportlab pytesseract
# OCR需要安装tesseract: sudo apt install tesseract-ocr tesseract-ocr-chi-sim
命令参考
详见 references/cli-reference.md