Tutorials

How to Compress a PDF Without Breaking a Digital Signature

Why compressing a digitally signed PDF breaks the signature, how to tell which kind of signature you have, and the safe way to get a small signed file.

By Ahtisham ul haq Khan

Founder, PDF Compress

Updated 2 min read
How to Compress a PDF Without Breaking a Digital Signature
On this page

If a PDF carries a certificate-based digital signature, compressing it will make the signature show as invalid. That is not a fault in the compressor: the signature exists to prove the file has not changed since it was signed, and compression changes the file. The fix is to change the order: compress first, then sign.

Why compression breaks a digital signature

A digital signature is calculated over the exact bytes of the file at the moment of signing. When a PDF reader checks the signature, it recalculates over the same bytes. Compression rewrites the file (images are re-encoded, fonts are subset, the internal structure is rebuilt), so the bytes no longer match and the reader reports that the document was changed after signing. This applies to every compressor, including ours, and to any tool that rewrites the whole file.

Which kind of signature do you have?

  • Certificate-based digital signature: when you open the file in Adobe Acrobat Reader, a bar or the Signatures panel shows the signature and whether it is valid. This kind breaks when the file is compressed.
  • Image of a signature: a drawn, typed or scanned signature placed on the page, with nothing listed in the Signatures panel. This is just part of the page; compressing the PDF is fine, though the signature image is compressed like any other image.

How to get a small, validly signed PDF

  1. Compress before signing. Finish the document, compress it to the size you need, then sign the compressed copy. The signature covers the small file and stays valid.
  2. Leave room for the signature. Signing adds the signature and certificate data to the file, so the signed file is larger than the one you signed. Compress a little below the limit and check the size after signing.
  3. If someone else signed it, do not compress their copy. Ask the signer for a compressed, re-signed version, or ask the recipient whether they accept a larger file or another delivery method.

Common questions

Is there a "lossless" way to shrink a signed PDF and keep the signature?

Not by rewriting the file. Any tool that saves the whole file again changes its bytes and invalidates the signature, even if it only cleans up the structure. Changes a signer allows, such as filling in a form or adding a further signature, are appended to the end of the file; they make it larger, never smaller.

Can I compress first and add an image signature afterwards?

Yes. An image signature is not verified cryptographically, so the order does not matter for it.

How do I compress the unsigned file?

Use the compressor, or a preset size such as 200 KB if the destination has a limit. Then sign the downloaded copy.

Related articles

How to Compress a PDF on Mac
Tutorials

How to Compress a PDF on Mac

Three ways to compress a PDF on a Mac: Preview's built-in filter, a browser tool when you need an exact size, and Ghostscript in Terminal for full control.