Reputation: 31
I would like to generate a digitally signed pdf with a signature image using the IronPdf library, but I am experiencing the following issue:
While the pdf is digitally signed, the signature's image does not seem to be rendering/appearing in the generated pdf.
The above code (that I am testing in a console app) is based on: https://ironpdf.com/docs/questions/signing/ (3rd case)
// Step 1. Create a PDF
ChromePdfRenderer Renderer = new ChromePdfRenderer();
using PdfDocument doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");
// Step 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
// Read: https://helpx.adobe.com/acrobat/using/digital-ids.html
var Signature = new IronPdf.Signing.PdfSignature("ChristosAsvestopoulos.pfx", "123abc!");
// Step 3. Optional signing options and a handwritten Signature graphic
Signature.SigningContact = "[email protected]";
Signature.SigningLocation = "Chicago, USA";
Signature.SigningReason = "To show how to sign a PDF";
Signature.LoadSignatureImageFromFile("handwriting.png");
//Step 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(Signature);
//Step 5. The PDF is not signed until saved to file, steam or byte array.
doc.SaveAs("signed.pdf");
Notes:
The .pfx file was created following this: https://helpx.adobe.com/acrobat/using/digital-ids.html
IronPdf version: 2022.8.7894
OS: Windows 10 Enterprise
application's framework: .NET Core 3.1
For handwriting.png
file I have also tried (without success) this: https://ironpdf.com/troubleshooting/digital-signatures/
Upvotes: 3
Views: 975
Reputation: 164
The issue has been fixed in IronPdf version 2023.3.2.
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>foo</h1>");
pdf.SaveAs("signed.pdf");
// Create PdfSignature object
var sig = new PdfSignature("IronSoftware.pfx", "123456");
// Add image
sig.SignatureImage = new PdfSignatureImage("IronSoftware.png", 0, new CropRectangle(0, 600, 100, 100));
// Sign and save PDF document
sig.SignPdfFile("signed.pdf");
Please visit Digitally Sign a PDF Document for more information.
Upvotes: 0
Reputation: 21
This is Vince from Iron Software. This is a known issue regarding Signatures - Image in digital signatures not visible and has been confirmed by IronPDF's engineers. It has been logged to our development team.
I have linked this article to the development ticket, so we will reach out and notify you once this is resolved in a future update.
You can send a follow up to [email protected] with Ticket# 54677.
Upvotes: 2