I’m using Aspose.PDF for .NET version 10.0.0. I’m attempting to add multiple fields with the same name to a pdf. I’ve been able to use the code snippet below to add multiple fields at different coordinates and on different pages, but numbers are appended to the field names for each field after the first field is added (e.g. “test”, “test1”, “test2”, “test3”). Is there a way to use the same field name for each field?
Thanks,
Kurt
var fieldList = new List<Fields>();
foreach (var field in fieldList)
{
var textBoxField = new TextBoxField(doc.Pages[field.PageNumber], new Rectangle(field.CoordinateLLX, field.CoordinateLLY, field.CoordinateURX, field.CoordinateURY));
textBoxField.PartialName = "test";
textBoxField.Width = field.Width;
textBoxField.Height = field.Height;
doc.Form.Add(textBoxField, field.PageNumber);
}
doc.Save(document.PathAndFileName);
@kmalecek,
The form field names are unique and we manipulate fields with name string. Please elaborate about the requirement. We will take a closer look, and then help you appropriately. Please also refer to this help topic: Working with Form Fields
The ultimate goal is to have multiple text fields in the same PDF with the name “Sig_es_:signer1:signature”. I can create a PDF manually in Adobe Acrobat DC with a text field by that name and copy and paste it multiple times without the field name changing.
When I create the PDF mentioned above with, for example, 5 text fields all with the same name (“Sig_es_:signer1:signature”) and set it as the “doc” variable in the code snippet above, the Form property of the document contains 1 field called “Sig_es_:signer1:signature”. The 1 field has coordinates that encapsulate all 5 of the text fields, but when searching the properties of the 1 field, I do not recognize any properties with identifying information for the fields contained within the 1 big field.
I say all of this to indicate that even though I have not been able to programmatically create the 5 identically named fields using the code snippet above, it looks like Aspose PDF is still able to recognize the end result I am trying to achieve if it’s created manually and loaded into the code.
This image shows the PDF manually created in Adobe DC with 5 different fields, all with the same name: Sig_es_:signer1:signature. 1.jpg (107.6 KB)
This image shows the same PDF above loaded into code similar to the snippet above. It’s stopped to show that the PDF has 1 form and 1 field. The 1 field is called Sig_es_:signer1:signature. The coordinates of the one field encapsulate all 5 of the fields with the name “Sig_es_:signer1:signature”. Is it possible to make 5 fields with the same name and if not, is it possible to create one of these large fields with the smaller fields inside of it, each with their own coordinates? 2.jpg (456.6 KB)
@kmalecek,
In order to achieve the requirements, we have logged enhancement tickets in our issue tracking system as follows:
PDFNET-43457: Cannot add multiple text box fields with the same name PDFNET-43458: Cannot recognize coordinates of the text box form fields with the same name
We have linked your post to these tickets and will keep you informed regarding any available updates.
We regretfully share that earlier logged issues are not yet resolved due to low priority. However, we have recorded your concerns and will surely let you know as soon as they are resolved. Please be patient and spare us little time.