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.

C# NuGet Library for PDF

Install with NuGet

Install-Package IronPdf
or
C# PDF DLL

Download DLL

Download DLL

Manually install into your project

Save 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
To improve PDF export performance, we have set the TrackChanges option to false. This option needs to be set to true in order to utilize the incremental save feature.

: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.FormFillingAllowed);

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.FormFillingAllowed)

Dim pdfWithRevision As PdfDocument = pdf.SaveAsRevision()

pdfWithRevision.SaveAs("annual_census_2.pdf")
VB   C#

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 IterationCertificate ACertificate BCertificate CCertificate 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, C, and D who all signed the document a final time with the "No Edits Allowed" permission. Because no illegal actions were taken in this document invalidating signatures, 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")
VB   C#