Hi, I have a similar need.
I have to add an empty signature field and then, with other library, I add to this field a signature from the smartcard.
Is it possible to add the empty field specifying to it must bu showed in all pages?
Ma code to add the empty field is simply:
Using editor As New FormEditor()
editor.BindPdf(“file.pdf”)
editor.AddField(FieldType.Signature, “Signature1”, 1, 360, 430, 480, 380)
editor.Save(“fileOut.pdf”)
End Using
Yes, you can use the same code to insert empty signature field into PDF. We suggest you please use the latest version of Aspose.PDF for .NET 22.12 and let us know how it goes on your side.
Thank you.
I’m able to add an empty signature field to a pdf, using the code above.
But, it is possible to create a single field, visible on all pages?
However, regarding the code you proposed to create multiple fields with the same name, it doesn’t work.
Please check the output file generated by your code:
In the second page, the field name is not “Signature”, but “Signature1”: Aspose library adds a “1” to the name specified by the call, if a field with the same name already exists.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-53486
You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.
We have investigated the issue and prepare next conclusions:
We tested creating multiple fields with the same name, and it does not works correctly (only 1(first) field shown, other fields will be invisible).
But we found the best decision for this case:
Copy link for first field on every page.
I am sure this code snippet will help:
using (var editor = new FormEditor())
{
editor.BindPdf(dataDir + "53486.pdf");
//Add field for page #1
editor.AddField(FieldType.Signature, "Signature", 1, 360, 430, 480, 380);
//Find added field
var addedField = editor.Document.Pages[1].Annotations[1];
//Add link of added field for another pages
for (int page = 2; page <= editor.Document.Pages.Count; page++)
{
editor.Document.Pages[page].Annotations.Add(addedField);
}
//Save result
editor.Save(dataDir + "53486_result.pdf");
}