How to Protect Digitally Signed PDFs: Flattening vs Document Locking
Question details
The user wants to understand the concepts of PDF flattening and refrying, specifically asking if flattening is necessary to protect digitally signed documents from unauthorized modifications.

- Product
- PDF Editors
- Device & OS
- not provided
- Scenario
- Attempting to secure a completed PDF document containing digital signatures against unauthorized edits and extraction.
- Observed behavior
- Flattening or refrying a digitally signed document breaks the cryptographic hash and invalidates existing digital signatures, compromising document security rather than enhancing it.
Before modifying your PDF, ensure you have finalized all content and saved a backup copy. Remember that any structural changes to a document after it has been digitally signed will permanently invalidate the existing cryptographic signatures.
Use Document Locking with the Final Digital Signature
The most secure and proper way to protect a signed PDF is to use the document-locking option during the final cryptographic signing process, which prevents further alterations without breaking the signature.
Flattening a signed document will immediately invalidate all digital signatures applied to it because it alters the underlying byte structure.
Instead of flattening, you should use the built-in locking feature during the final signature process. This locks down form fields and content while providing cryptographic evidence that the document has not been tampered with.
Open your PDF document in your PDF editor and navigate to the 'Protect' or 'Digital Signature' tool tab.
Click on the designated signature field, or draw a new signature field on the document to apply your final digital signature.
In the signature dialog box where you select your certificate, check the box labeled 'Lock document after signing' before clicking the Sign button.
Save the PDF to finalize the signature. Any subsequent attempts to edit the document will be blocked by the software, and unauthorized forced changes will display the signature as invalid.

Export to Image for True Flattening (For Unsigned Drafts Only)
If you need to completely merge visual elements like stamp images into a single uneditable layer before applying a final cryptographic signature, you must rasterize the document by exporting it as an image.
Secure and Sign Your PDFs with WPS Office
WPS Office provides professional PDF editing tools, allowing you to easily manage form flattening, apply secure digital signatures, and lock documents against unauthorized modifications.
- 1. Open your PDF: Launch WPS Office and open the PDF document you wish to securely sign.
- 2. Navigate to protection tools: Go to the 'Protect' tab on the top ribbon to access the security and digital signature features.
- 3. Sign and lock: Click 'Sign Document', select your digital ID, and ensure the document is locked upon saving to secure your finalized file.

Frequently Asked Questions
Why does flattening a PDF invalidate my digital signature?
Flattening alters the internal byte structure of the PDF by converting interactive form fields and annotations into static graphic objects. Cryptographic digital signatures mathematically rely on the exact structure of the document at the time it was signed; any change to this structure breaks the cryptographic hash, rendering the signature invalid.
What does it mean to "refry" a PDF?
Refrying a PDF refers to the process of recreating a PDF by printing it to a virtual PDF printer (like "Print to PDF") or rasterizing it. This is generally discouraged as a security method because it strips out critical metadata, ruins text searchability, removes accessibility tags, and degrades image quality.
Are flattened PDF objects completely secure from extraction?
Not necessarily. Standard flattening processes often convert elements into standard graphic objects within the PDF rather than a single flat image. With advanced PDF editors, these graphic objects (like an image of a handwritten signature) can still be selected, copied, and extracted. True rasterization (exporting to an image) is required to merge them into an indistinguishable background layer.
Should I flatten a PDF before or after digitally signing it?
If you need to flatten form fields or comments, you must do so before applying any digital signatures. Once the document is flattened to your satisfaction, you can apply the digital signature and use the 'Lock document' option to secure the final version without invalidating the cryptographic certificate.




