FormElement Name property allowed characters

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v12)  /  FormElement Name property allowed characters

DynamicPDF CoreSuite for .NET (v12) Forum

Hello, I am looking for clarity around what characters are allowed in FormElement names, as I've been encountering issues with certain characters (square brackets and periods specifically).

If I add a TextField element to a MergeDocument with the name "S3.1", I get an exception when I attempt to render the PDF with the Draw() method saying "Form Field with the same name already exists."

Short example:

var documentBytes = File.ReadAllBytes("C:\test\test.pdf");
var pdf = new MergeDocument(documentBytes);
var textField = new TextField("S3.1", 10, 10, 50, 20)
{
  DefaultValue = "testvalue"
};

pdf.Pages[0].Elements.Add(textField);
var newPdf = pdf.Draw(); // generates an exception
Update:

Important to note if there are two fields named "S3.1" and "S3" respectively on the same document, it will throw the exception "Form Field with the same name already exists."

It appears that there may be some kind of truncation after the period happening.  Is this expected behavior?
Posted by a ceTe Software moderator
Hi,

The TextField name associated with a period represents a parent and child relationship in the PDF. Also form field names should be unique in the PDF. This is expected behavior.

If a form field with the same name exists, then please use a unique name. You can use an underscore instead of using a period in the form field name.

If you continue facing an issue, then please send the following information to support@dynamicpdf.com so we can look into it further.

1. Code sample which uses static data to recreate the error.
2. Source PDF used for merging.
3. Full error message along with stack trace.
4. Exact version and build number of the DynamicPDF DLL file used in your application. You can find this information by right clicking on the DLL file>>Properties>>Details tab>>Product version. Take a screenshot of the Details tab and send it over to us.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 5:29 PM.