如何将PDF文件中的页面图像向左或向右移动更多? [英] How can I shift page images in PDF files more to the left or to the right?
问题描述
我们有一堆扫描的页面(约600张),每个PDF查看器在其右边缘显示零边距,在左边显示2英寸边距显示图像. (大概是在扫描时,使用了错误的设置...)
We have a bunch of scanned pages (about 600) for which every PDF viewer displays the image with zero margin on the right edge, but about 2 inch margin on the left. (Presumably while scanning, there was a wrong setting used...)
我们希望将这些页面打印为小册子.有没有办法将所有页面图像永久地移向中心,并让PDF以更令人满意的方式显示这些页面? Ghostscript可以做到吗?可以使用其他方法来做到这一点吗,例如在某些PDF处理库的帮助下进行编程?
We want to print these pages, preferably as a booklet. Is there a way to permanently shift all page images towards the center and have the PDF display these pages also in a more pleasing way? Can Ghostscript do that? Can one do this with some other method, such as programatically with the help of some PDF processing library?
推荐答案
如果您不想编写自己的程序代码(如Nikolaus所建议),而是使用Ghostscript命令行,则需要了解3件事:
If you don't want to write your own program code (as Nikolaus suggested), but use a Ghostscript commandline instead, you need to know 3 things:
- PostScript具有
setpagedevice
运算符,该运算符带有PageOffset
参数; - 如果您在命令行上使用
-c ...
传递,Ghostscript将处理PostScript代码片段; - 即使直接进行 PDF => PDF 转换,Ghostscript也可以评估和应用(某些) PostScript 代码.
- PostScript has a
setpagedevice
operator that takes aPageOffset
parameter; - Ghostscript will process snippets of PostScript code if you pass them with
-c ...
on the commandline; - Ghostscript can evaluate and apply (some) PostScript code even for direct PDF=>PDF conversions.
现在尝试使用此命令行将所有页面图像向左移动1英寸(== 72pt):
Now try this commandline to shift all page images by 1 inch (==72pt) to the left:
gswin32c.exe ^
-sDEVICE=pdfwrite ^
-o c:/path/to/output/pdf-shifted-by-1-inch-to-left.pdf ^
-dPDFSETTINGS=/prepress ^
-c "<</PageOffset [-72 0]>> setpagedevice" ^
-f c:/path/to/input/pdf-original.pdf
(为了不降低扫描图像质量而放入的-dPDFSETTINGS=/prepress
...)
(The -dPDFSETTINGS=/prepress
I put in in order to not loose any picture quality of the scans...)
这篇关于如何将PDF文件中的页面图像向左或向右移动更多?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!