Cómo guardar y editar el historial de revisiones de PDF en C#

How to Save & Edit PDF Revision History

This article was translated from English: Does it need improvement?
Translated
View the article in English

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.

Quickstart: Save PDF Revisions with IronPDF)

Effortlessly manage and save PDF revisions using IronPDF in your C# applications. This quick guide demonstrates the simplicity of saving document versions with IronPDF's SaveAsRevision method, allowing for seamless tracking and management of PDF changes. Begin by loading a PDF file and saving it as a distinct revision, ensuring all modifications are securely archived.

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf

  2. Copy and run this code snippet.

    var pdf = IronPdf.PdfDocument.FromFile("example.pdf");
    pdf.SaveAsRevision("revision1.pdf");
  3. Deploy to test on your live environment

    Start using IronPDF in your project today with a free trial
    arrow pointer

as-heading:3(Minimal Workflow (5 steps)

  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.

Por favor notaTo 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

Preguntas Frecuentes

¿Cómo puedo gestionar el historial de revisiones de PDF en C#?

Puede gestionar el historial de revisiones de PDF en C# utilizando la biblioteca de IronPDF. Proporciona métodos como SaveAsRevision para guardar diferentes versiones de un PDF y GetRevision para recuperar esas versiones.

¿Cuál es el propósito de guardar revisiones de PDF?

Guardar revisiones de PDF le permite seguir los cambios en el documento a lo largo del tiempo, lo cual es esencial en entornos colaborativos. IronPDF facilita esto permitiendo guardar y recuperar versiones del documento.

¿Cómo puedo recuperar una versión anterior de un PDF?

Para recuperar una versión anterior de un PDF, puede usar el método GetRevision de IronPDF. Este método le permite acceder o regresar a revisiones específicas del documento.

¿Qué es el guardado incremental en documentos PDF?

El guardado incremental en PDFs permite que los cambios se almacenen de manera similar a un historial de commits. Esta característica es particularmente útil para gestionar firmas digitales e historiales de revisión, que se pueden manejar eficientemente con IronPDF.

¿Cómo funcionan las firmas digitales con las revisiones de PDF?

Las firmas digitales se aplican a revisiones particulares de un documento PDF. En IronPDF, una vez que un documento está firmado, cualquier cambio posterior invalidará la firma para esa revisión específica.

¿Puedo establecer permisos para firmas digitales en PDFs?

Sí, con IronPDF puedes establecer permisos para firmas digitales, como permitir únicamente ediciones de llenado de formularios, lo que ayuda a mantener la validez de la firma a menos que se realicen ediciones no autorizadas adicionales.

¿Cómo vuelvo a una revisión anterior de un PDF?

Para volver a una revisión anterior de un PDF, use el método GetRevision de IronPDF. Esto le permite revertir el documento a un estado específico y descartar cualquier cambio realizado después de esa revisión.

¿Cómo puedo mejorar el rendimiento de exportación de PDF?

En IronPDF, desactivar la opción TrackChanges puede mejorar el rendimiento de exportación de PDF. Sin embargo, esta opción debe estar habilitada si desea mantener el guardado incremental y el historial de revisiones.

¿Dónde puedo descargar la biblioteca IronPDF?

La biblioteca IronPDF se puede descargar del repositorio de paquetes NuGet en https://nuget.org/packages/IronPdf/.

¿IronPDF es compatible con .NET 10 y el historial de revisiones funciona de la misma manera?

Sí. IronPDF es totalmente compatible con .NET 10, y las funciones de historial de revisiones como SaveAsRevision , GetRevision , el guardado incremental y el seguimiento de cambios funcionan de la misma forma en proyectos .NET 10 que en versiones anteriores compatibles. IronPDF es compatible con entornos .NET Core 5–10, .NET Standard 2.0+ y .NET Framework 4.6.2+.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Nuget Descargas 16,154,058 | Versión: 2025.11 recién lanzado