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.

Get started with IronPDF

Start using IronPDF in your project today with a free trial.

First Step:
green arrow pointer


Steps to Save & Edit PDF Revision History

  1. Download the C# Library to Save and Edit PDF Revision History with IronPDF
  2. Use the SaveAsRevision method to save the PDF as versions.
  3. Retrieve the PDF versions using the GetRevision method.
  4. Access the RevisionCount property to get the revision count.
  5. Save and export your PDF.

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 noteTo improve PDF export performance, we have set the TrackChanges option to false. This option needs to be set to true 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.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")
$vbLabelText   $csharpLabel

Understanding Incremental Saving for Signatures

While some viewers like the Chrome browser show only 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 this:

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 document that has been through 6 different iterations. This document may be 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 Persons 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.

: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")
$vbLabelText   $csharpLabel

Frequently Asked Questions

How can I manage PDF revision history in C#?

You can manage PDF revision history in C# using the IronPDF library. It provides methods like SaveAsRevision for saving different versions of a PDF and GetRevision for retrieving those versions.

What is the purpose of saving PDF revisions?

Saving PDF revisions allows you to track document changes over time, which is essential in collaborative environments. IronPDF facilitates this by allowing saving and retrieving of document versions.

How can I retrieve a previous version of a PDF?

To retrieve a previous version of a PDF, you can use IronPDF's GetRevision method. This method enables you to access or roll back to specific document revisions.

What is incremental saving in PDF documents?

Incremental saving in PDFs allows changes to be stored in a way similar to a commit history. This feature is particularly useful for managing digital signatures and revision histories, which can be efficiently handled with IronPDF.

How do digital signatures work with PDF revisions?

Digital signatures apply to particular revisions of a PDF document. In IronPDF, once a document is signed, any further changes will invalidate the signature for that specific revision.

Can I set permissions for digital signatures in PDFs?

Yes, with IronPDF, you can set permissions for digital signatures, such as allowing only form-filling edits, which helps maintain signature validity unless further unauthorized edits are made.

How do I roll back to a previous PDF revision?

To roll back to a previous PDF revision, use IronPDF's GetRevision method. This allows you to revert the document to a specific state and discard any changes made after that revision.

How can I enhance PDF export performance?

In IronPDF, disabling the TrackChanges option can improve PDF export performance. However, this option needs to be enabled if you wish to maintain incremental saving and revision history.

Where can I download the IronPDF library?

The IronPDF library can be downloaded from the NuGet package repository at https://nuget.org/packages/IronPdf/.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.