Our legal team needed a way to track document changes across multiple signature rounds. Contracts would pass through 5-6 people, each adding signatures or filling fields, but we had no audit trail showing what changed when.
PDFs support embedded revision history—like Git for documents. Here's how I implemented it in C# to maintain complete change tracking for compliance.
What Is PDF Revision History?
PDF revision history stores multiple versions of a document within a single PDF file. Each revision captures the document state at a specific point in time, creating an audit trail of changes.
using IronPdf;
// Install via NuGet: Install-Package IronPdf
var pdf = PdfDocument.FromFile("contract.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
// Edit the document (add text, fill forms, etc.)
pdf.Form.FindFormField("clientName").Value = "Acme Corp";
// Save as a new revision
var revised = pdf.SaveAsRevision();
revised.SaveAs("contract-v2.pdf");
The resulting PDF contains both the original and revised versions. Advanced PDF viewers like Adobe Acrobat show the complete history.
Why Track Revisions?
Before implementing revision tracking, our workflow looked like this:
- Send contract-v1.pdf
- Recipient signs, returns contract-v1-signed.pdf
- Next person signs, creates contract-v1-signed-final.pdf
- Someone edits, creates contract-v1-signed-final-ACTUAL.pdf
File names became meaningless, and we had no way to verify what changed between versions. Revision history solved this by embedding everything in one file with a clear timeline.
How Do Revisions Work with [[[[Digital Signatures](https://ironpdf.com/blog/videos/how-to-sign-pdf-files-in-csharp-using-ironpdf-ironpdf-tutorial/)](https://ironpdf.com/blog/videos/how-to-sign-pdf-files-in-csharp-using-ironpdf-ironpdf-tutorial/)](https://ironpdf.com/python/blog/using-ironpdf-for-python/digital-signature-python-tutorial/)](https://ironpdf.com/blog/compare-to-other-components/add-digital-signature-topdf-in-csharp-using-itextsharp/)?
Digital signatures apply to a specific document revision. If you modify the PDF after signing, the signature becomes invalid—unless the signer explicitly allowed certain changes.
using IronPdf;
using IronPdf.Signing;
var pdf = PdfDocument.FromFile("contract.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
// Sign with permission to fill forms only
pdf.SignWithFile("certificate.p12", "password", null, SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);
// Save this signed version as a revision
var signedRevision = pdf.SaveAsRevision();
signedRevision.SaveAs("contract-signed.pdf");
This signature remains valid if someone fills form fields later, but becomes invalid if they add pages, delete content, or modify text.
What Are Signature Permission Levels?
When signing, you specify what future modifications are allowed:
No Changes Allowed: Any edit invalidates the signature. Use for final, locked documents.
pdf.SignWithFile("cert.p12", "password", null, SignaturePermissions.NoChangesAllowed);
Form Filling Only: Users can fill form fields, but nothing else. Use for contracts where recipients complete fields after signing.
pdf.SignWithFile("cert.p12", "password", null, SignaturePermissions.FormFillingAllowed);
Additional Signatures and Form Filling: Users can add more signatures or fill forms. Use for multi-party agreements.
pdf.SignWithFile("cert.p12", "password", null, SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);
I use the third option for contracts that require sequential signatures from multiple departments.
How Do I Enable Revision Tracking?
Set TrackChanges: ChangeTrackingModes.EnableChangeTracking when loading the PDF:
using IronPdf;
using IronPdf.Rendering;
var pdf = PdfDocument.FromFile("document.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
// Make changes...
pdf.Form.FindFormField("status").Value = "Approved";
// Save as revision
var revised = pdf.SaveAsRevision();
revised.SaveAs("document-approved.pdf");
Without TrackChanges, IronPDF doesn't maintain incremental saves, and revisions aren't stored.
How Do I Retrieve Previous Revisions?
Use GetRevision with a zero-based index:
using IronPdf;
var pdf = PdfDocument.FromFile("multi-revision.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
int revisionCount = pdf.RevisionCount;
Console.WriteLine($"Total revisions: {revisionCount}");
for (int i = 0; i < revisionCount; i++)
{
var revision = pdf.GetRevision(i);
Console.WriteLine($"Revision {i}: {revision.PageCount} pages");
revision.SaveAs($"revision-{i}.pdf");
}
This extracts each revision as a separate PDF, useful for audits or comparing changes across versions.
Can I See Who Signed Each Revision?
Yes, inspect the signature properties:
using IronPdf;
var pdf = PdfDocument.FromFile("signed-contract.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
foreach (var signature in pdf.Signature.Signatures)
{
Console.WriteLine($"Signer: {signature.SignerName}");
Console.WriteLine($"Date: {signature.SignDate}");
Console.WriteLine($"Reason: {signature.Reason}");
Console.WriteLine($"Permissions: {signature.Permissions}");
}
This outputs the name, date, reason for signing, and permission level for each signature in the document.
What Happens If Someone Violates Signature Permissions?
The signature status changes to "Invalid." PDF viewers display a warning that the document was modified in a way not permitted by the signer.
For example, if Alice signs with FormFillingAllowed, but Bob later adds a page, Alice's signature becomes invalid. The PDF still displays her signature, but with a red warning icon.
I built validation into our workflow that checks signature status before routing documents:
var pdf = PdfDocument.FromFile("contract.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
bool allSignaturesValid = pdf.Signature.VerifySignatures().All(s => s.Status == SignatureStatus.Valid);
if (!allSignaturesValid)
{
Console.WriteLine("Document has invalid signatures. Rejecting.");
}
This prevents documents with tampered signatures from progressing through our approval pipeline.
How Do I Compare Two Revisions?
Extract each revision and compare programmatically:
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
var revision1 = pdf.GetRevision(0);
var revision2 = pdf.GetRevision(1);
string text1 = revision1.ExtractAllText();
string text2 = revision2.ExtractAllText();
// Use diff library to compare text1 and text2
I use DiffPlex (a C# diff library) to generate HTML reports showing exactly what changed between revisions. This is helpful for legal review.
Can I Roll Back to a Previous Revision?
Extract the revision and save it as a new document:
using IronPdf;
var pdf = PdfDocument.FromFile("document.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
var previousVersion = pdf.GetRevision(2); // Get third revision (0-indexed)
previousVersion.SaveAs("restored-version.pdf");
This creates a new PDF containing only the content from that revision. Note: signatures from later revisions are lost.
What's the File Size Impact of Revisions?
Each revision adds storage for the changes. If you add pages or large images, file size increases significantly.
A contract I worked with grew from 200KB to 1.2MB after five revisions with signatures and form changes. Most of the growth came from embedded signature certificates and new pages.
To minimize size:
- Compress images before adding them
- Use form filling instead of adding new content
- Consider flattening the PDF after all signatures are collected
How Do I Flatten a PDF to Remove Revisions?
Flattening converts the PDF to a static document, discarding revision history:
using IronPdf;
var pdf = PdfDocument.FromFile("multi-revision.pdf");
// No TrackChanges parameter - we're not maintaining revisions
pdf.SaveAs("flattened.pdf");
This creates a new PDF with only the current state. Use this for archival copies where you don't need the change history.
Can I Export Revision Metadata?
Build a metadata report from revisions:
using IronPdf;
using System.Text.Json;
var pdf = PdfDocument.FromFile("document.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
var metadata = new List<object>();
for (int i = 0; i < pdf.RevisionCount; i++)
{
var revision = pdf.GetRevision(i);
metadata.Add(new
{
RevisionNumber = i,
PageCount = revision.PageCount,
CreationDate = revision.MetaData.CreatedDate,
ModifiedDate = revision.MetaData.ModifiedDate
});
}
string json = JsonSerializer.Serialize(metadata, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText("revision-metadata.json", json);
This generates a JSON file documenting each revision for compliance audits.
What About Alternatives to IronPDF?
iTextSharp supports incremental saves but doesn't have high-level revision management APIs. You'd need to manually parse PDF structure to extract revisions.
Aspose.PDF has similar capabilities but with a more complex API. Licensing costs are higher for commercial projects.
Adobe PDF Library (C++ with .NET wrappers) offers comprehensive revision tracking but requires significant integration effort.
I chose IronPDF because SaveAsRevision and GetRevision are straightforward, and the signature permission model integrates cleanly with our workflow.
How Do I Test Signature Invalidation?
Create a test workflow:
using IronPdf;
using IronPdf.Signing;
// Create and sign a PDF
var pdf = PdfDocument.FromFile("test.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
pdf.SignWithFile("cert.p12", "password", null, SignaturePermissions.FormFillingAllowed);
var signed = pdf.SaveAsRevision();
signed.SaveAs("test-signed.pdf");
// Reload and make an unauthorized edit
var reloaded = PdfDocument.FromFile("test-signed.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
reloaded.AddHtml("<h1>Unauthorized Edit</h1>");
reloaded.SaveAs("test-tampered.pdf");
// Verify signatures
var tampered = PdfDocument.FromFile("test-tampered.pdf");
var results = tampered.Signature.VerifySignatures();
foreach (var result in results)
{
Console.WriteLine($"Signature valid: {result.Status == SignatureStatus.Valid}");
}
The signature verification shows False because adding HTML content wasn't permitted.
Should I Always Enable Revision Tracking?
Not always. Revisions add complexity and file size. Use them when:
- Compliance required: Legal, medical, or financial documents needing audit trails
- Multi-party signatures: Multiple people sign sequentially
- Change verification: You need to prove what changed and when
Skip revisions for:
- Generated reports: No signature or approval workflow
- Internal documents: No compliance requirements
- One-time PDFs: No future edits expected
In our system, contracts and compliance documents use revisions. Invoices and reports don't.
Written by Jacob Mellor, CTO at Iron Software. Jacob created IronPDF and leads a team of 50+ engineers building .NET document processing libraries.
Top comments (0)