Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies within .NET ( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Mon Nov 01, 2021 8:53 am

Hi,

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);
   

bradjen
 
Posts: 9
Joined: Thu Jul 25, 2019 6:07 am

Mon Nov 01, 2021 9:54 am

Hello,

Thank you for your inquiry.
Please set the NeedAppearances as false to eliminate the prompt when saving. If you have other question, please feel free to write back.
Code: Select all
...
pdfdoc.Form.NeedAppearances = false;
pdfdoc.SaveToFile("AddSignField.pdf", FileFormat.PDF);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 712
Joined: Wed Apr 07, 2021 2:50 am

Mon Nov 01, 2021 10:23 am

Hi,

Thx for reply! I have tested on Spire.Office 6.9.1 and this solution works!!
This solution don't work on Spire.Office 5.8.5 that we use on most production envioriments.
As i said it's big bite to migrate from 5.8.5 to 6.9.1 because native image library is removed. Can we get some fix to this version, or we need to migrate code...??
Thx.

bradjen
 
Posts: 9
Joined: Thu Jul 25, 2019 6:07 am

Tue Nov 02, 2021 7:21 am

Hi,

Thank you for your feedback.
Kindly note that we made some adjustments to our products dlls. Actually, the .Net Core projects use .Net Standard dlls by default when you install our nuget latest Spire.Office 6.10.3 package, our .Net Standard dlls depend on SkiaSharp instead of System.Drawing.Common.
Please install our Spire.Office. NETCore 6.10.3 from NuGet Manager, then the System.Drawing.Common library will be included. If there is still any question, please feel free to write back.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 712
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.PDF