Creating New TextFields

Creating New TextFields

Forum member · Apr 23, 2007
Has anyone had any issues creating new TextFields? When I try to compile the following: TextField tf = new TextField(); I get an error indicating that TextField is an abstract class or interface. Based on some sample code that I've seen (see my previous post about assigning values to a new FormField), my understanding is that I should be able to do this. Thanks, Jeff

Re: Creating New TextFields

Forum member · Apr 23, 2007
It appears that I can create a TextField from the ceTe.DynamicPDF.PageElements.Forms namespace, but not from the ceTe.DynamicPDF.Forms namespace. When I create a ceTe.DynamicPDF.PageElements.Forms.TextField, I am unable to add it to a Field.ChildFields collection, as the fields in the collection are of type ceTe.DynamicPDF.Forms.TextField. This is extremely concerning to me and I'm hoping that there's something that I'm just missing.

Re: Creating New TextFields

Support · Apr 23, 2007
Hello Jeff, Everything you have pointed out in the above posts is correct and is by design. Basically you can think about it like this, the forms in the ceTe.DynamicPDF.Forms collection area the form fields that already existed on the PDF. For any new form fields that you want to add to the page you will do this with a form field page element object (in the ceTe.DynamicPDF.PageElements.Forms namespace). These new form field page elements (along with any page elements) are actually always added to the Page object (not the ceTe.DynamicPDF.Forms collection as you were attempting). Any form field page elements that you add to the page do eventually get added to the existing form field collection in the PDF but this is all done at draw time (when the Draw or DrawToWeb method is called). Hope this helps you see things a little better. Feel free to ask if you need any further clarification. Thanks, ceTe Software Support Team

Re: Creating New TextFields

Forum member · Apr 23, 2007
Hello, Thank you for your reply. Perhaps if I lay out my scenario, you might be able to help me better. If I have a template doc that looks something like this: static field static field dynamic section static field If I don't have any prior knowledge about the layout of the template (ideally it will be dictated by our professional services organization or by the clients themselves), then I won't necessarily know where the dynamic section needs to be on the page. My hope was that I could create a subform and add new FormFields to the subform, but I'm not sure that that is supported. When I get at the static field via the Form.Fields collection, is there a way for me to determine its location within the page? Thanks, Jeff

Re: Creating New TextFields

Support · Apr 24, 2007
Hello Jeff, It is not supported to create sub forms and adding form fields to the sub forms using our product. You will have to add the form fields to the pages of the document. You can get the page number of the page where the form field is present by using the GetOriginalPageNumber method of the form field. You can refer to the Form Flattening topic on help documentation which shows using this method. Thanks, ceTe Software Support Team.