Based on example https://www.e-iceblue.com/Tutorials/Spi ... o-PDF.html i added signature field to an existing pdf document (pdf document is created by Spire.Doc saveToFile(file, FileFormat.PDF). I add and save pdf with empty signature field. Later when open pdf document with Adobe Acrobat Reader program promt me on close "Do you want to save changes before closing"... We are currently using third part library for signing pdf document with empty signature fields. Library is unable to put signature... If we before sending pdf to library use Acrobat Reader and on close - save pdf document - library put signature field successfully. Below is code from example.
I tried to add and other forms fields like text box, buttons... but result is the same. Acrobat Reader ask me if i want to save changes - so i can conclude that sometnihg is wrong with Spire.Pdf library. We are licenced to 6.10.3 and 6.9.1 Spire.Office. We didnt yet migrated code from 6.9.1 (System.Drawing.Common is removed and its a big bite to do now).
We tried with both version but behavior is the same. If you find a solution to this we expext some hot fix to 6.9.1. version with System.Drawing.Common included.
- Code: Select all
PdfDocument pdfdoc = new PdfDocument();
PdfPageBase page = pdfdoc.Pages.Add();
PdfSignatureField signaturefield = new PdfSignatureField(page, "Signature");
signaturefield.BorderWidth = 1.0f;
signaturefield.BorderStyle = PdfBorderStyle.Solid;
signaturefield.BorderColor = new PdfRGBColor(System.Drawing.Color.Black);
signaturefield.HighlightMode = PdfHighlightMode.Outline;
signaturefield.Bounds = new RectangleF(100, 100, 100, 100);
pdfdoc.Form.Fields.Add(signaturefield);
pdfdoc.SaveToFile("AddSignField.pdf", FileFormat.PDF);