Chuyển đến nội dung

Nén PDF

Làm PDF nhỏ lại, và không bao giờ lớn hơn.

Xử lý trên thiết bị của bạn

Công cụ này chạy hoàn toàn trong trình duyệt của bạn. Tệp của bạn không bao giờ được tải lên, và bạn có thể tự kiểm chứng điều đó trong tab mạng của trình duyệt. Tự kiểm chứng: mở tab mạng của trình duyệt và theo dõi. Bạn sẽ thấy một yêu cầu nhỏ hỏi xem bạn còn tác vụ nào không - một tên công cụ và một mã băm, không bao giờ là tệp.

Công cụ này làm gì

Two different things make a PDF smaller, and this tool does both in turn. The structural pass repacks the file's objects and recompresses its streams, which is lossless and usually saves 10 to 25 per cent on a document nobody has optimised before. The image pass re-encodes the pictures at a lower resolution, which is where the large reductions on a scan come from, and it is lossy. Both results are measured against the original, and if neither won you get your own file back rather than a slightly bigger one labelled compressed.

The trigger is almost always a limit somewhere else: a mail server that bounces attachments over 25 MB, an application portal that stops at 2 MB, or a 40 MB scanned contract that has to reach someone on a phone connection.

Cách hoạt động

  1. Drop the PDF onto this page. Files up to 300 MB are accepted.
  2. Pick a level. Light is structure only and changes nothing you can see; Balanced re-encodes images at 150 dpi; Strong drops to 100 dpi for getting a scan under an attachment limit.
  3. Choose Custom to set the numbers yourself - resolution between 72 and 300 dpi, quality between 30 and 95 per cent.
  4. Open advanced options if you also want the images turned grey, the metadata stripped, or a filled form flattened first. Each makes the file smaller.
  5. Press Compress. The result reports the size before and after, and how many pages were re-encoded.

The structural pass is qpdf rewriting the file with object streams, compressed cross-references and every flate stream recompressed at level 9. Nothing about the page content changes, so it always runs whatever level you picked. On a file that has already been through a good optimiser it saves nothing at all, which is a real outcome rather than a failure.

The image pass works by re-rendering. A browser cannot reach inside a PDF and re-encode the pictures in place, so every page is drawn at the resolution you chose and written back as a JPEG. That would normally cost you the text, so the text is read out with PDF.js first and drawn back over the images in an invisible layer, keeping words selectable and searchable. What this route cannot carry across is links, form fields and annotations - if you need those, use Light.

The rule this tool will not break is that it never hands back a bigger file. An already-optimised document, and one whose images are stored more efficiently than a fresh JPEG of the same page, both genuinely come out larger. When that happens the original bytes are returned untouched and the result says the file was already optimised, because a compressor that grows your file and reports success is worse than no compressor.

Knowing where the size sits will save you a disappointment. In a scan it is the images, so Strong can take 40 MB to under 5 MB. In a text report it is the embedded fonts and the structure, so 10 to 20 per cent is a good result and re-encoding its few images changes very little.

Everything runs on your device. qpdf and PDF.js are compiled to WebAssembly and run in Web Workers, so a 300 MB scan is processed without a byte being sent anywhere.

Công cụ này không làm được gì

  • Anything above Light re-encodes the images, which is lossy - fine print in a scan softens, and the loss cannot be undone from the output file.
  • A document that has already been optimised may not shrink at all. In that case the original is returned unchanged and the result says so.
  • When the image pass wins, the pages are rebuilt from pictures, so links, form fields and annotations are not carried over. The text layer is, invisibly.

Câu hỏi thường gặp

Tệp của tôi sẽ nhỏ đi bao nhiêu?
Tùy vào nội dung bên trong. Tài liệu quét là ảnh, nên mức Cân bằng thường đưa nó xuống còn một phần tư kích thước và mức Mạnh xuống dưới một phần mười. Tài liệu văn bản là phông chữ và cấu trúc, nơi lần xử lý không mất dữ liệu giảm được 10 đến 25 phần trăm và không còn nhiều để tiết kiệm thêm. Kết quả hiển thị cả hai con số để bạn quyết định có thử mức mạnh hơn không.
Tài liệu trông vẫn ổn chứ?
Ở mức Nhẹ, trông giống hệt, vì chỉ cấu trúc tệp thay đổi. Ở mức Cân bằng, ảnh được mã hóa lại ở 150 dpi, đọc tốt trên màn hình và in được ở mức chấp nhận được. Ở mức Mạnh, 100 dpi có thể nhận ra khi nhìn kỹ một bản quét nhưng vẫn ổn để đọc. Hãy kiểm tra một trang của kết quả trước khi xóa bản gốc.
Vì sao tệp của tôi không nhỏ đi chút nào?
Vì nó đã được tối ưu từ trước. Các tệp xuất ra từ phần mềm hiện đại, hoặc đã qua một công cụ nén, không còn gì để đóng gói thêm. Thay vì trả về một tệp lớn hơn đôi chút kèm thông báo thành công, công cụ trả lại bản gốc cho bạn và nói rõ điều đó.
Nén có làm văn bản không tìm kiếm được không?
Không. Khi lần xử lý ảnh chạy, văn bản được trích xuất trước khi các trang bị thay thế và được vẽ lại vô hình lên trên các ảnh, nên bạn vẫn có thể chọn, tìm kiếm và sao chép nó. Thứ bị mất trên đường này là liên kết, trường biểu mẫu và chú thích, đó là lý do mức Nhẹ tồn tại.
Tệp của tôi có được tải lên để nén không?
Không. Việc nén diễn ra bên trong trình duyệt của bạn, với qpdf và PDF.js chạy dưới dạng WebAssembly trong Web Worker. Hãy mở công cụ dành cho nhà phát triển, chuyển sang tab mạng và nén thử một tệp: không có yêu cầu nào gửi ra ngoài, và công cụ hoạt động ngoại tuyến sau khi trang đã tải xong.
Tôi nên dùng mức nào để lọt dưới giới hạn của email?
Hãy bắt đầu với mức Cân bằng và xem kích thước được báo. Nếu vẫn vượt, hãy thử mức Mạnh, và nếu vẫn chưa đủ thì bật chuyển ảnh sang xám trong tùy chọn nâng cao, việc này thường bỏ thêm được một phần ba đối với một bản quét màu.

Công cụ liên quan