【发布时间】:2012-02-17 16:51:15
【问题描述】:
我正在寻找一种工具来提取 1 页 PDF 文件的给定矩形区域(按坐标)并生成具有指定区域的 1 页 PDF 文件:
# in.pdf is a 1-page pdf file
extract file.pdf 0 0 100 100 > out.pdf
# out.pdf is now a 1-page pdf file with a page of size 100x100
# it contains the region (0, 0) to (100, 100) of file.pdf
我可以将 PDF 转换为图像并使用 convert,但这意味着生成的 PDF 将不再是矢量的,这是不可接受的(我希望能够缩放)。
理想情况下,我希望使用命令行工具或 Python 库来执行此任务。
谢谢!
【问题讨论】:
标签: python pdf command-line extract crop