如何将 PDF 文件中的页面图像更多地向左或向右移动? [英] How can I shift page images in PDF files more to the left or to the right?

查看:54
本文介绍了如何将 PDF 文件中的页面图像更多地向左或向右移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一堆扫描的页面(大约 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:

  1. PostScript 有一个 setpagedevice 操作符,它接受一个 PageOffset 参数;
  2. 如果您在命令行中使用 -c ... 传递 PostScript 代码片段,Ghostscript 将处理它们;
  3. Ghostscript 可以评估和应用(一些)PostScript 代码,甚至可以用于直接PDF=>PDF 转换.
  1. PostScript has a setpagedevice operator that takes a PageOffset parameter;
  2. Ghostscript will process snippets of PostScript code if you pass them with -c ... on the commandline;
  3. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆