Guía para desarrolladores sobre la firma digital de archivos PDF con C#
Esta completa guía muestra a los desarrolladores de C# cómo firmar digitalmente archivos PDF con IronPDF, e incluye firmas basadas en certificados, sellos visuales y campos de formulario interactivos para garantizar la autenticidad y la seguridad de los documentos.
Agregar una firma a un documento PDF es un requisito común en muchas aplicaciones, pero "firmar" puede significar diferentes cosas. Para algunos, se trata de aplicar una firma digital a prueba de manipulaciones usando un certificado de seguridad. Para otros, podría ser estampar una imagen de firma manuscrita visual en un documento o agregar un campo de formulario interactivo para que los usuarios firmen electrónicamente.
Esta guía proporciona un recorrido completo para que los desarrolladores de C# logren todas estas tareas usando la biblioteca IronPDF para .NET. Cubriremos todo, desde aplicar una firma digital segura X509Certificate2 hasta estampar firmas gráficas y crear campos de firma interactivos, asegurando que tus documentos PDF sean auténticos, seguros y profesionales.
Inicio rápido: Firme digitalmente un PDF sin esfuerzo usando IronPDF
Comienza rápidamente con IronPDF para firmar digitalmente tus documentos PDF utilizando un proceso simple y directo. Este ejemplo demuestra cómo usar un certificado .pfx para autenticar y firmar un archivo PDF, asegurando la integridad y autenticidad del documento. Siga estos pasos para integrar perfectamente la firma digital en su aplicación.
Empieza a crear PDF con NuGet ahora:
Instalar IronPDF con el gestor de paquetes NuGet
Copie y ejecute este fragmento de código.
new IronPdf.Signing.PdfSignature("certificate.pfx", "password").SignPdfFile("input.pdf");Despliegue para probar en su entorno real
Empieza a utilizar IronPDF en tu proyecto hoy mismo con una prueba gratuita
Flujo de trabajo mínimo (5 pasos)

- Instale la biblioteca IronPDF for .NET.
- Apply a digital signature using an `X509Certificate2` object.
- Añade una imagen visual para representar la firma digital.
- Estampar una firma gráfica o manuscrita en un archivo PDF.
- Añadir un campo de formulario de firma interactivo para la firma electrónica.
¿Cómo aplicar una firma digital a un PDF con un certificado?
Puedes aplicar una firma digital a un documento PDF usando un archivo de certificado digital (como .pfx o .p12) para garantizar la autenticidad e integridad del documento. Este proceso asegura que el documento no haya sido alterado desde que fue firmado. Para obtener una visión completa de las funciones de firma digital, consulte nuestra guía completa sobre firmas digitales.
IronPDF proporciona una API sencilla para este propósito, admitiendo múltiples formas de aplicar una firma digital. El núcleo de esta funcionalidad gira en torno a la clase PdfSignature, que encapsula el certificado y todos los metadatos asociados con la firma.
| Método de firma | Descripción |
|---|---|
Firma un PDF con un objeto PdfSignature que tú creas y configuras. | |
Firma un PDF utilizando un archivo de certificado de firma digital (.pfx o .p12) ubicado en el disco. | |
| Firma un PDF con una firma digital del almacén de certificados de tu ordenador, identificada por su identificador de huella digital. |
Uso de un objeto X509Certificate2
Para el máximo control, puedes crear un objeto X509Certificate2 a partir de tu archivo de certificado. IronPDF cumple completamente con el estándar X509Certificate2, proporcionando un método robusto y seguro para la implementación de firmas digitales. Al crear el objeto de certificado, asegúrese de que las X509KeyStorageFlags se establecen en Exportable, ya que así lo requieren las API criptográficas subyacentes. Consulte ejemplos prácticos de firmas digitales en nuestro repositorio de código.
Install-Package IronPdf
using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
// Create a new PDF from an HTML string for demonstration.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Signed Document</h1><p>This document has been digitally signed.</p>");
// Load the certificate from a .pfx file with its password.
// The X509KeyStorageFlags.Exportable flag is crucial for allowing the private key to be used in the signing process.
var cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);
// Create a PdfSignature object using the loaded certificate.
var signature = new PdfSignature(cert);
// Apply the signature to the PDF document.
pdf.Sign(signature);
// Save the securely signed PDF document.
pdf.SaveAs("Signed.pdf");using IronPdf;
using IronPdf.Signing;
using System.Security.Cryptography.X509Certificates;
// Create a new PDF from an HTML string for demonstration.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Signed Document</h1><p>This document has been digitally signed.</p>");
// Load the certificate from a .pfx file with its password.
// The X509KeyStorageFlags.Exportable flag is crucial for allowing the private key to be used in the signing process.
var cert = new X509Certificate2("IronSoftware.pfx", "123456", X509KeyStorageFlags.Exportable);
// Create a PdfSignature object using the loaded certificate.
var signature = new PdfSignature(cert);
// Apply the signature to the PDF document.
pdf.Sign(signature);
// Save the securely signed PDF document.
pdf.SaveAs("Signed.pdf");El código anterior primero genera un PDF simple. Luego carga un archivo de certificado .pfx en un objeto X509Certificate2. Este objeto, que representa la identidad digital, se pasa al constructor de PdfSignature. Finalmente, el método pdf.Sign aplica esta firma al documento antes de guardarlo. For more information on the X509Certificate2 class, you can refer to the official Microsoft documentation.
Añadir detalles detallados a una firma digital
Una firma digital puede contener más que solo el certificado; puedes incrustar metadatos enriquecidos para proporcionar contexto sobre la firma. Esto incluye la ubicación de la firma, el motivo, la información de contacto y una marca de tiempo segura de una autoridad de confianza. También puede establecer y editar metadatos para obtener propiedades adicionales del documento.
Agregar estos detalles mejora la pista de auditoría del documento y proporciona a los verificadores información valiosa. IronPDF también admite servidores de marcas de tiempo que utilizan algoritmos hash modernos SHA256 y SHA512.
using IronPdf;
using IronPdf.Signing;
using IronSoftware.Drawing;
using System;
// Load an existing PDF document to be signed.
var pdf = PdfDocument.FromFile("invoice.pdf");
// Create a PdfSignature object directly from the certificate file and password.
var signature = new PdfSignature("IronSoftware.pfx", "123456");
// Add detailed metadata to the signature for a comprehensive audit trail.
// These properties enhance the signature's credibility and provide context
signature.SignatureDate = DateTime.Now;
signature.SigningContact = "legal@ironsoftware.com";
signature.SigningLocation = "Chicago, USA";
signature.SigningReason = "Contractual Agreement";
// Add a secure timestamp from a trusted Time Stamp Authority (TSA).
// This provides cryptographic proof of the signing time.
signature.TimeStampUrl = new Uri("[http://timestamp.digicert.com](http://timestamp.digicert.com)");
signature.TimestampHashAlgorithm = TimestampHashAlgorithms.SHA256;
// Apply a visual appearance to the signature. (More on this in the next section)
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, new Rectangle(350, 750, 200, 100));
// Sign the PDF document with the configured signature object.
pdf.Sign(signature);
// Save the final, signed PDF document.
pdf.SaveAs("DetailedSignature.pdf");using IronPdf;
using IronPdf.Signing;
using IronSoftware.Drawing;
using System;
// Load an existing PDF document to be signed.
var pdf = PdfDocument.FromFile("invoice.pdf");
// Create a PdfSignature object directly from the certificate file and password.
var signature = new PdfSignature("IronSoftware.pfx", "123456");
// Add detailed metadata to the signature for a comprehensive audit trail.
// These properties enhance the signature's credibility and provide context
signature.SignatureDate = DateTime.Now;
signature.SigningContact = "legal@ironsoftware.com";
signature.SigningLocation = "Chicago, USA";
signature.SigningReason = "Contractual Agreement";
// Add a secure timestamp from a trusted Time Stamp Authority (TSA).
// This provides cryptographic proof of the signing time.
signature.TimeStampUrl = new Uri("[http://timestamp.digicert.com](http://timestamp.digicert.com)");
signature.TimestampHashAlgorithm = TimestampHashAlgorithms.SHA256;
// Apply a visual appearance to the signature. (More on this in the next section)
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, new Rectangle(350, 750, 200, 100));
// Sign the PDF document with the configured signature object.
pdf.Sign(signature);
// Save the final, signed PDF document.
pdf.SaveAs("DetailedSignature.pdf");Puedes notar un icono de advertencia en algunos visores de PDF si el certificado de firma no está en el almacén de confianza del sistema. Para obtener una marca de verificación verde, el certificado debe agregarse a las identidades de confianza del visor.
¿Cómo puedo añadir una representación visual a una firma digital?
Si bien una firma digital se incrusta criptográficamente en el PDF, a menudo es útil tener una representación visual en la página. Esto puede ser un logotipo de la empresa, una imagen de firma manuscrita u otros gráficos. IronPDF facilita la adición de una imagen a un objeto PdfSignature.
Puedes cargar una imagen desde un archivo o una secuencia y posicionarla con precisión en cualquier página del PDF. Los formatos de imagen compatibles son PNG, JPEG, GIF, BMP, TIFF y WebP. Esta técnica es similar a la de estampar texto e imágenes en documentos PDF.
using IronPdf.Signing;
using IronSoftware.Drawing;
// This example demonstrates various ways to add a visual image to a PDF signature.
// Create a PdfSignature object.
var signature = new PdfSignature("IronSoftware.pfx", "123456");
// Define the position and size for the signature image on the first page (index 0).
// Rectangle parameters: x position, y position, width, height
var signatureRectangle = new Rectangle(350, 750, 200, 100);
// Option 1: Set the SignatureImage property directly.
// This is the most straightforward approach
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, signatureRectangle);
// Option 2: Use the LoadSignatureImageFromFile method.
// This method provides the same functionality with a different syntax
signature.LoadSignatureImageFromFile("assets/visual-signature.png", 0, signatureRectangle);
// Option 3: Load an image from a stream. This is useful for images generated in memory.
// Perfect for scenarios where images are retrieved from databases or web services
AnyBitmap image = AnyBitmap.FromFile("assets/visual-signature.png");
using (var imageStream = image.ToStream())
{
signature.LoadSignatureImageFromStream(imageStream, 0, signatureRectangle);
}
// After configuring the signature image, apply it to a PDF.
var pdf = PdfDocument.FromFile("invoice.pdf");
pdf.Sign(signature);
pdf.SaveAs("VisualSignature.pdf");using IronPdf.Signing;
using IronSoftware.Drawing;
// This example demonstrates various ways to add a visual image to a PDF signature.
// Create a PdfSignature object.
var signature = new PdfSignature("IronSoftware.pfx", "123456");
// Define the position and size for the signature image on the first page (index 0).
// Rectangle parameters: x position, y position, width, height
var signatureRectangle = new Rectangle(350, 750, 200, 100);
// Option 1: Set the SignatureImage property directly.
// This is the most straightforward approach
signature.SignatureImage = new PdfSignatureImage("assets/visual-signature.png", 0, signatureRectangle);
// Option 2: Use the LoadSignatureImageFromFile method.
// This method provides the same functionality with a different syntax
signature.LoadSignatureImageFromFile("assets/visual-signature.png", 0, signatureRectangle);
// Option 3: Load an image from a stream. This is useful for images generated in memory.
// Perfect for scenarios where images are retrieved from databases or web services
AnyBitmap image = AnyBitmap.FromFile("assets/visual-signature.png");
using (var imageStream = image.ToStream())
{
signature.LoadSignatureImageFromStream(imageStream, 0, signatureRectangle);
}
// After configuring the signature image, apply it to a PDF.
var pdf = PdfDocument.FromFile("invoice.pdf");
pdf.Sign(signature);
pdf.SaveAs("VisualSignature.pdf");Este código muestra tres formas equivalentes de agregar un componente visual a una firma digital. Ya sea que tengas una imagen en el disco o en la memoria, puedes estamparla fácilmente en el PDF como parte del proceso de firma. Esto cierra la brecha entre la seguridad criptográfica invisible y la aprobación visible del documento.
¿Cómo puedo controlar los permisos de los documentos después de firmarlos?
Cuando firmas un documento, es posible que desees especificar qué cambios, si los hay, están permitidos después. Por ejemplo, es posible que desees bloquear el documento por completo o solo permitir que los usuarios llenen campos de formulario. IronPDF te permite establecer estos permisos usando la enumeración SignaturePermissions. Para un control de permisos más avanzado, consulte nuestra guía sobre configuración de contraseñas y permisos de PDF.
Establecer permisos de firma es una parte clave del manejo del ciclo de vida de un documento. Asegura que la integridad del documento se mantenga según tus reglas después de que se aplique tu firma. Si un usuario realiza una acción no permitida, la firma se invalidará.
Miembro de SignaturePermissions | Definición |
|---|---|
SinCambiosPermitidos | No se permiten cambios de ningún tipo. El documento está efectivamente bloqueado. |
| Sólo se permite rellenar campos de formularios existentes y firmar. | |
| Permite rellenar formularios, firmar y crear o modificar anotaciones. |
Saving and Signing a Specific PDF Revision
PDFs can store a history of changes, much like a version control system. This is known as incremental saving. When you sign a PDF, the signature applies to a specific revision of the document. This is crucial for workflows where a document goes through multiple stages of approval. Learn more about managing PDF revision history in our detailed guide.
In the following example, we load a PDF, make edits, and then sign the current revision while allowing only form-filling as a future change. We use SaveAsRevision to commit the current state to the document's history before saving the file.
using IronPdf.Signing;
// Load a PDF file with change tracking enabled.
// This enables incremental save functionality for revision management
var pdf = PdfDocument.FromFile("annual_census.pdf", ChangeTrackingModes.EnableChangeTracking);
// Placeholder for edits: You might add text, fill forms, or add annotations here.
// For example: pdf.Annotations.Add(new TextAnnotation(...));
// Or: pdf.Form["fieldName"].Value = "New Value";
// Sign the current state of the document using SignWithFile for convenience.
// We set permissions to allow further signatures and form filling.
pdf.SignWithFile(
"assets/IronSignature.p12",
"password",
SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);
// Save the current state as a distinct revision within the PDF's history.
// This creates a snapshot that can be referenced later
PdfDocument pdfWithRevision = pdf.SaveAsRevision();
// Save the final PDF with its full revision history to a new file.
pdfWithRevision.SaveAs("annual_census_signed.pdf");using IronPdf.Signing;
// Load a PDF file with change tracking enabled.
// This enables incremental save functionality for revision management
var pdf = PdfDocument.FromFile("annual_census.pdf", ChangeTrackingModes.EnableChangeTracking);
// Placeholder for edits: You might add text, fill forms, or add annotations here.
// For example: pdf.Annotations.Add(new TextAnnotation(...));
// Or: pdf.Form["fieldName"].Value = "New Value";
// Sign the current state of the document using SignWithFile for convenience.
// We set permissions to allow further signatures and form filling.
pdf.SignWithFile(
"assets/IronSignature.p12",
"password",
SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);
// Save the current state as a distinct revision within the PDF's history.
// This creates a snapshot that can be referenced later
PdfDocument pdfWithRevision = pdf.SaveAsRevision();
// Save the final PDF with its full revision history to a new file.
pdfWithRevision.SaveAs("annual_census_signed.pdf");Understanding incremental saves is key to advanced PDF workflows. While a simple viewer might only show the latest version, a tool like Adobe Acrobat can reveal the entire revision history, showing who signed which version and what changes were made between signatures. IronPDF gives you full programmatic control over this process.
For businesses managing complex document workflows that require high security and compliance, a comprehensive solution may be needed. Iron Software offers Iron Suite, which includes IronPDF for signing and manipulation, plus other libraries for a wide range of document processing tasks, available for a single one-time payment.
How Can I Manage and Verify Signatures Across Revisions?
A PDF document can have multiple signatures applied across its various revisions. IronPDF provides tools to manage this history effectively.
- Roll Back to a Previous Revision: You can revert a document to an earlier state using the
GetRevisionmethod. This will discard all changes and signatures made after that revision. - Verify All Signatures: The
VerifySignaturesmethod checks the validity of all signatures across all revisions of the document. It returnstrueonly if every signature is valid and no unauthorized changes have been made. - Remove Signatures: The
RemoveSignaturesmethod will strip all digital signatures from every revision of the document, creating a clean, unsigned version.
// Load a PDF with a complex signature history.
var pdf = PdfDocument.FromFile("multi_signed_report.pdf");
// Verify all signatures across all revisions.
// This ensures document integrity throughout its entire history
bool allSignaturesValid = pdf.VerifySignatures();
Console.WriteLine($"All signatures are valid: {allSignaturesValid}");
// Roll back to the first revision (index 0).
// Useful for reviewing the original document state
if (pdf.RevisionCount > 1)
{
PdfDocument firstRevision = pdf.GetRevision(0);
firstRevision.SaveAs("report_first_revision.pdf");
}
// Create a completely unsigned version of the document.
// This removes all digital signatures while preserving content
pdf.RemoveSignatures();
pdf.SaveAs("report_unsigned.pdf");// Load a PDF with a complex signature history.
var pdf = PdfDocument.FromFile("multi_signed_report.pdf");
// Verify all signatures across all revisions.
// This ensures document integrity throughout its entire history
bool allSignaturesValid = pdf.VerifySignatures();
Console.WriteLine($"All signatures are valid: {allSignaturesValid}");
// Roll back to the first revision (index 0).
// Useful for reviewing the original document state
if (pdf.RevisionCount > 1)
{
PdfDocument firstRevision = pdf.GetRevision(0);
firstRevision.SaveAs("report_first_revision.pdf");
}
// Create a completely unsigned version of the document.
// This removes all digital signatures while preserving content
pdf.RemoveSignatures();
pdf.SaveAs("report_unsigned.pdf");How Do I Stamp a Handwritten Signature onto a PDF?
Sometimes, you don't need the cryptographic security of a digital signature but simply want to apply a visual, electronic signature, like a scanned handwritten signature. This is often referred to as stamping. IronPDF can do this using its Watermark or Stamp features. For more advanced watermarking options, explore our custom watermarks guide.
Let's start with a sample invoice PDF and a .png image of a handwritten signature.
The original invoice PDF before stamping a signature.
Here is the signature image we will apply:
A sample handwritten signature image.
The following code uses the Watermark property to stamp this image onto the bottom-right corner of the PDF.
using IronPdf.Editing;
// Load the existing PDF document.
var pdf = PdfDocument.FromFile("invoice.pdf");
// Create an HtmlStamp containing our signature image.
// HtmlStamp allows us to position HTML content precisely on the page
var signatureStamp = new HtmlStamp("<img src='assets/signature.png'/>")
{
// Configure the stamp's position and appearance.
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Right,
Margin = 10, // Add some space from the edge.
Opacity = 90 // Make it slightly transparent for a more authentic look.
};
// Apply the stamp to all pages of the PDF.
// You can also specify specific page numbers if needed
pdf.ApplyStamp(signatureStamp);
// Save the modified PDF document.
pdf.SaveAs("official_invoice.pdf");using IronPdf.Editing;
// Load the existing PDF document.
var pdf = PdfDocument.FromFile("invoice.pdf");
// Create an HtmlStamp containing our signature image.
// HtmlStamp allows us to position HTML content precisely on the page
var signatureStamp = new HtmlStamp("<img src='assets/signature.png'/>")
{
// Configure the stamp's position and appearance.
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Right,
Margin = 10, // Add some space from the edge.
Opacity = 90 // Make it slightly transparent for a more authentic look.
};
// Apply the stamp to all pages of the PDF.
// You can also specify specific page numbers if needed
pdf.ApplyStamp(signatureStamp);
// Save the modified PDF document.
pdf.SaveAs("official_invoice.pdf");What Does the Stamped PDF Result Look Like?
After running the code, the signature image is stamped onto the document, creating a visually signed invoice.
The final PDF with the handwritten signature image stamped in the bottom-right corner.
How Can I Add an Interactive Signature Field to a PDF?
For documents that need to be signed by an end-user in a PDF viewer like Adobe Acrobat, you can add an interactive signature form field. This creates an empty, clickable area that prompts the user to apply their own digital signature. For a complete guide on PDF forms, see our creating PDF forms tutorial.
You can create a SignatureFormField and add it to the PDF's form collection. You have precise control over its location and size on the page. This is particularly useful for documents that require multiple signatures or when you need to collect signatures from external parties.
using IronPdf.Forms;
using IronSoftware.Drawing;
// Create a new PDF to add the signature field to.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Firme a continuación</h1>");
// Define the properties for the signature form field.
string fieldName = "ClientSignature"; // Unique identifier for the field
int pageIndex = 0; // Add to the first page (zero-indexed)
var fieldRect = new Rectangle(50, 200, 300, 100); // Position: (x, y), Size: (width, height)
// Create the SignatureFormField object.
// This creates an interactive field that users can click to sign
var signatureField = new SignatureFormField(fieldName, pageIndex, fieldRect);
// Add the signature field to the PDF's form.
pdf.Form.Add(signatureField);
// Save the PDF with the new interactive signature field.
pdf.SaveAs("interactive_signature.pdf");using IronPdf.Forms;
using IronSoftware.Drawing;
// Create a new PDF to add the signature field to.
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Firme a continuación</h1>");
// Define the properties for the signature form field.
string fieldName = "ClientSignature"; // Unique identifier for the field
int pageIndex = 0; // Add to the first page (zero-indexed)
var fieldRect = new Rectangle(50, 200, 300, 100); // Position: (x, y), Size: (width, height)
// Create the SignatureFormField object.
// This creates an interactive field that users can click to sign
var signatureField = new SignatureFormField(fieldName, pageIndex, fieldRect);
// Add the signature field to the PDF's form.
pdf.Form.Add(signatureField);
// Save the PDF with the new interactive signature field.
pdf.SaveAs("interactive_signature.pdf");When a user opens this PDF, they will see a clickable field, allowing them to complete the signing process using their own digital ID. You can learn more about creating and managing interactive forms in our How-To guide on creating PDF forms.
An unsigned, interactive signature field added programmatically to a PDF document.
How Do I Retrieve the Signer Name from Verified Signatures?
To obtain the common name of the certificate owner who signed a signature, we can use the VerifiedSignature class to access the SignerName property. Below is a code snippet demonstrating how to accomplish this.
:path=/static-assets/pdf/content-code-examples/how-to/signing-find-signer-name.csusing IronPdf;
using System;
// Import the Signed PDF report
var pdf = PdfDocument.FromFile("multi_signed_report.pdf");
// Using GetVerifiedSignatures() obtain a list of `VerifiedSignature` objects from the PDF
pdf.GetVerifiedSignatures().ForEach(signature =>
{
// Print out the SignerName of each `VerifiedSignature` object
Console.WriteLine($"SignatureName: {signature.SignerName}");
});Después de importar el archivo PDF firmado, utilizamos el método GetVerifiedSignatures para recuperar una lista de objetos VerifiedSignature dentro del informe e imprimir el SignerName de cada firma.
Tenga en cuenta que este valor se extrae del Subject Distinguished Name (SubjectDN) del certificado y devolverá un valor nulo si el campo CN no está presente.
¿Cuáles son los siguientes pasos para la firma de PDF con IronPDF?
Esta guía ha demostrado las potentes y flexibles funciones de firma de PDF de IronPDF. Tanto si necesita aplicar firmas digitales seguras con metadatos detallados, gestionar revisiones de documentos, estampar firmas visuales o crear formularios interactivos, IronPDF proporciona una API completa y fácil de usar para los desarrolladores.
Para seguir explorando, puede descargar la librería IronPDF for .NET y obtener una licencia de prueba gratuita para probar todas sus funciones en sus proyectos. Para conocer técnicas más avanzadas de manipulación de documentos, como añadir anotaciones y trabajar con campos de formulario, consulte nuestra amplia documentación y tutoriales.
Listo para ver qué más puedes hacer? Consulta nuestra página de tutoriales aquí: Firmar y proteger PDFs
Preguntas Frecuentes
¿Cómo firmo digitalmente un PDF utilizando un certificado en C#?
Con IronPDF, puede firmar digitalmente un PDF en una sola línea de código utilizando la clase PdfSignature. Basta con crear un nuevo objeto PdfSignature con el archivo de certificado (.pfx o .p12) y la contraseña y, a continuación, llamar al método SignPdfFile(). Por ejemplo: new IronPDF.Signing.PdfSignature("certificado.pfx", "contraseña").SignPdfFile("entrada.pdf"). Esto aplica una firma digital a prueba de manipulaciones utilizando su X509Certificate2 para garantizar la autenticidad del documento.
¿Qué tipos de firmas PDF son compatibles?
IronPDF admite tres tipos principales de firmas PDF: 1) Firmas digitales que utilizan certificados X509Certificate2 para la autenticación y a prueba de manipulaciones, 2) Sellos de firma visuales que añaden imágenes de firmas gráficas o manuscritas a los documentos, y 3) Campos de formulario de firma interactivos que permiten a los usuarios firmar electrónicamente los PDF. Cada tipo sirve para fines distintos en cuanto a la seguridad de los documentos y los requisitos del flujo de trabajo.
¿Qué formatos de certificado pueden utilizarse para la firma digital?
IronPDF admite los formatos de certificado digital más comunes, incluidos los archivos .pfx (Personal Information Exchange) y .p12. Estos archivos de certificado contienen tanto la clave pública como la clave privada necesarias para la firma digital. La clase PdfSignature de IronPDF puede trabajar con cualquier objeto X509Certificate2, lo que proporciona flexibilidad a la hora de cargar y gestionar los certificados de firma.
¿Puedo añadir una representación visual a mi firma digital?
Sí, IronPDF le permite añadir elementos visuales a sus firmas digitales. Puede incluir una representación gráfica, como una imagen de firma manuscrita, el logotipo de la empresa o un sello personalizado, junto a la firma criptográfica. Esto combina la seguridad de los certificados digitales con la confirmación visual, haciendo que los documentos firmados sean tanto seguros como profesionalmente presentables.
¿Cómo puedo crear un campo de firma interactivo para que los usuarios firmen electrónicamente?
IronPDF permite añadir campos de formulario de firma interactivos a documentos PDF. Estos campos permiten a los usuarios firmar documentos electrónicamente haciendo clic y dibujando su firma o cargando una imagen de firma. Esta función es perfecta para crear documentos que requieran recogida de firmas, como contratos o formularios que deban ser firmados por varias partes.
¿La firma de un PDF garantiza la integridad del documento?
Sí, cuando se firma digitalmente un PDF utilizando IronPDF con un X509Certificate2, se crea un sello a prueba de manipulaciones que garantiza la integridad del documento. La firma digital garantiza que el documento no ha sido alterado desde que se firmó. Cualquier modificación del PDF después de la firma invalidará la firma, alertando a los destinatarios de que el documento puede haber sido comprometido.







