跳到正文

裁剪 PDF

修整页面的可见区域——手动、按形状或自动。

在你的设备上处理

这款工具完全在你的浏览器中运行。文件从不上传,你可以在浏览器的网络标签中亲自验证这一点。 亲自验证:打开浏览器的网络标签观察。你会看到一个查询你是否还有剩余任务的小请求,只包含工具名称和一段哈希,绝不会包含文件。

这款工具的作用

Cropping a PDF sets its crop box, which tells a reader which part of each sheet to display. It does not delete anything: the content outside the box is still in the file, and widening the box again brings it back. That is worth knowing before you crop a signature or an account number off something and send it on.

The usual reasons are a scanner that left 15 mm of grey around every page, a document with margins so wide it wastes half a tablet screen, a page that has to fit a slide or an e-reader, or receipts photographed with a desk in the frame.

工作原理

  1. Drop the PDF onto this page and wait for the first page to render.
  2. Choose the mode: drag the rectangle yourself, let the tool find the content, or crop to a fixed shape.
  3. For a manual crop, drag the handles, or type what to take off each edge in millimetres, points or inches.
  4. For an automatic crop, set the breathing room to leave around the content - six points is a sensible start.
  5. Decide whether to crop every page or only a range, then press Crop.
  6. Check a page in the downloaded file before you discard the original.

The automatic mode is why most people come here. Each page is rendered small - 400 pixels on its long edge, which is ample, since ink boundaries do not move when you look at them from further away - and every pixel more than about 9 percent away from white counts as content. The bounding box of that content, plus your margin, becomes the crop box. Rendering 300 pages at full resolution to find their margins would cost more than the crop.

Automatic cropping measures each page separately, so pages end up different sizes when their content does. That suits reading on a screen and is awkward for printing, where one tray wants one size; crop by hand or by shape if every page must match. A page with no ink has no box to compute, so it keeps its full size rather than being cropped to nothing, and a document where every page is blank is refused rather than destroyed.

Crop to a shape takes the largest rectangle of the proportions you pick that fits inside the page, centred. A4 is the 1:1.414 shape of the paper itself, so it trims a letter-sized page to those proportions; 16:9 on a portrait page removes a great deal of height, which is the point when the result is going into a slide. Nothing is scaled - only the visible window changes.

Also shrink the page size reduces the media box along with the crop box, so readers and printer drivers that ignore the crop box obey too. It is harder to undo, and it is still not deletion: the content outside is exactly where it was.

Everything happens in your browser: PDF.js renders the pages to measure them and pdf-lib writes the boxes. The pages are never re-encoded, so a scan keeps its original image data at full resolution.

这款工具做不到的事

  • Cropping hides content, it does not remove it. Everything outside the crop box remains in the file and reappears the moment somebody widens the box. Use Redact PDF when the content must actually be gone.

常见问题

被裁掉的内容真的没了吗?
没有真的没。裁剪写入一个裁剪框,告诉阅读器显示什么;框外的文本和图像在文件中丝毫未动,任何拉宽这个框的工具都能把它们找回来。如果你裁剪是为了隐藏签名、地址或银行信息,请改用涂黑 PDF,它会从像素重建页面,因此下面什么都不剩。
自动修整页边距是怎样判断内容在哪里的?
每页会以长边 400 像素渲染,凡是与白色相差超过约 9% 的像素都被视为墨迹——这个阈值的选取,是为了不把灰色扫描纸误当内容,同时又能识别出淡黄色高亮。这些像素的边界框,经你的留白扩大并夹到页面内,就成为裁剪框。
我能只裁剪部分页面,或分别裁剪吗?
可以。把“应用于”从每一页切换为一个范围并指定页面;其余保持原样。在自动模式下,范围内每一页都根据自身内容测量,因此混合文档不会套用某一页的页边距。
之后我能撤销裁剪吗?
可以,用一个更大的框再次裁剪即可——什么都没被移除,所以内容会回来。如果你开启了“同时缩小页面尺寸”,会更费事,因为纸张本身被重新定义了。无论哪种情况,检查完结果之前都请保留原件。
为了测量,文档会离开我的设备吗?
不会。用于找出页边距的渲染发生在你机器上 Web Worker 里的 OffscreenCanvas 上,那些像素从不离开它。自动裁剪确实需要查看页面——它在本地查看,什么都不会被传输。

相关工具