How to Save & Edit PDF Revision History
PDF revision history refers to a feature or capability that allows you to track and manage changes made to a PDF document over time. It's often used in situations where multiple users collaborate on a document, and you want to maintain a record of the document's revisions, including who made the changes and when.
In the context of digital signatures, IronPdf features the capability to manage revision history and roll back to a specific version.
How to Save & Edit PDF Revision History
- Download the C# Library to save and edit PDF revision history
- Use the
SaveAsRevision
method to save the PDF as versions - Retrieve the PDF versions using the
GetRevision
method - Access the RevisionCount property to get revision count
- Save and export your PDF
Install with NuGet
Install-Package IronPdf
Download DLL
Manually install into your project
Install with NuGet
Install-Package IronPdf
Download DLL
Manually install into your project
Start using IronPDF in your project today with a free trial.
Check out IronPDF on Nuget for quick installation and deployment. With over 8 million downloads, it's transforming PDF with C#.
Install-Package IronPdf
Consider installing the IronPDF DLL directly. Download and manually install it for your project or GAC form: IronPdf.zip
Manually install into your project
Download DLLSave and Sign a PDF Revision Iteration
In the following example we open a PDF file, make various edits, then before we save we will sign it. For signature permissions, we will only allow form-filling as future edits, otherwise the signature will be invalidated from any other edit.
We will then call SaveAsRevision
to save the revision to the history and then save our new document to disk.
Please note
:path=/static-assets/pdf/content-code-examples/how-to/signing-revision.cs
using IronPdf;
using IronPdf.Rendering;
// Import PDF and enable TrackChanges
PdfDocument pdf = PdfDocument.FromFile("annual_census.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
// ... various edits ...
pdf.SignWithFile("/assets/IronSignature.p12", "password", null, IronPdf.Signing.SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);
PdfDocument pdfWithRevision = pdf.SaveAsRevision();
pdfWithRevision.SaveAs("annual_census_2.pdf");
Imports IronPdf
Imports IronPdf.Rendering
' Import PDF and enable TrackChanges
Private pdf As PdfDocument = PdfDocument.FromFile("annual_census.pdf", TrackChanges:= ChangeTrackingModes.EnableChangeTracking)
' ... various edits ...
pdf.SignWithFile("/assets/IronSignature.p12", "password", Nothing, IronPdf.Signing.SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed)
Dim pdfWithRevision As PdfDocument = pdf.SaveAsRevision()
pdfWithRevision.SaveAs("annual_census_2.pdf")
Understanding Incremental Saving for Signatures
While some viewers like Chrome browser only show one version, PDF files have the capability to store previous versions of the document similar to a Git commit history. You will see this in more advanced PDF viewers such as Adobe Acrobat.
When dealing with PDF signatures, it is important to know about this because the action of signing a PDF applies to the current iteration of the PDF. Your PDF may have signatures for older iterations, or may have a few unsigned versions. We can visualize an example like follows:
PDF Document Iteration | Certificate A | Certificate B | Certificate C | Certificate D |
---|---|---|---|---|
0 (first save) | ✅ | |||
1 | ||||
2 | ||||
3 | ✅ (form field edits only) | ✅ (form field edits only) | ||
4 (only form fields edited) | ✅ | |||
5 | ✅ (no further edits allowed) | ✅ (no further edits allowed) | ✅ (no further edits allowed) |
Above, we have a documents that has been through 6 different iterations. This document may be being passed around departments of a company with approval until being finalized at iteration 3. In this iteration, both Person A and Person B signed the document with the permission "Form Field Edits Only" set. This means that filling in form fields in the PDF document is allowed, but any other change to the document will invalidate their signatures.
In the example above we can assume Person C is the one who has filled out the form and sent it back to Person A, B, and D who all signed the document a final time with the "No Edits Allowed" permission. Since no invalidating actions were taken in this document, when we run IronPDF's signature method, we will get true.
Roll back to an Old Revision
To roll back to a previous revision of a PDF, you can use the GetRevision
method. This will forget any changes made since this revision including newer signatures. To do this use:
:path=/static-assets/pdf/content-code-examples/how-to/signing-revert-revision.cs
using IronPdf;
PdfDocument pdf = PdfDocument.FromFile("report.pdf");
int versions = pdf.RevisionCount; // total revisions
PdfDocument rolledBackPdf = pdf.GetRevision(2);
rolledBackPdf.SaveAs("report-draft.pdf");
Imports IronPdf
Private pdf As PdfDocument = PdfDocument.FromFile("report.pdf")
Private versions As Integer = pdf.RevisionCount ' total revisions
Private rolledBackPdf As PdfDocument = pdf.GetRevision(2)
rolledBackPdf.SaveAs("report-draft.pdf")