Form Filling

Form Filling

Forum member · Oct 14, 2009
Hi, Is there any way, we can identify the "Table" element in the PDF Template as a "Table" (not a FormField) and add new rows to it. Regards, Renil

Re: Form Filling

Support · Oct 14, 2009
Hello Renil, Are you trying to add new rows to a table from an existing PDF document? If so it is not possible to edit the table from an existing PDF document. You can add new rows to the table only when you are creating the table. Also it is not possible to retrieve the existing table form the PDF in any way. Please be more specific about the requirement you have so that we can help you further. Thanks, ceTe Software Support Team.

Re: Form Filling

Forum member · Oct 14, 2009
The scenario is: I have an editable PDF form with me. I am trying to fill the data programmatically. The PDF form has a table in it, which I am getting as FormField when I am using "Document.Form.Fields". Based on the data I may need to add more rows to the table and draw the remaining rows to the next page and so on. I haven't seen a method to clone the FormField, so that I can change the name and add it to the table child fields. Is there any possibility of manupulating the table like this. Please advise. Regards, Renil

Re: Form Filling

Support · Oct 14, 2009
Hello Renil, It looks like you have some form fields in the structure of a table and it is not an actual table. It is not possible to move the existing form fields. You can add new form fields and new pages without any problem to an existing PDF document. You can also add the Table element for the existing PDF document. So when you want to add more data to the existing PDF you can do this by adding the page elements or by adding new form fields. Thanks, ceTe Software Support Team.

Re: Form Filling

Forum member · Oct 14, 2009
Thank you so much for your quick response. The table is created by Adobe Livecycle designer and has only row. Basically I am trying to clone the row (so that I can get the formatting and font) and add these rows to the table. If I am adding Page Elements, is there any way I can find the current Y coordinate for a FormField, so that I can add the row next to the exisitng row. Regards, Renil

Re: Form Filling

Support · Oct 14, 2009
Hello Renil, It is possible to find the coordinates of the form fields that exist on the PDF document by using the GetX and GetY methods. Following is the sample code: PdfDocument mPdfpage = new PdfDocument("C:\Temp\DocumentA.pdf"); MergeDocument mPdfdoc = new MergeDocument(mPdfpage); ceTe.DynamicPDF.Page page = mPdfdoc.Pages[0]; float fltX = mPdfpage.Form.Fields["txtPostal"].GetX(page); float fltY = mPdfpage.Form.Fields["txtPostal"].GetY(page); Thanks, ceTe Software Support Team.

Re: Form Filling

Forum member · Nov 5, 2009
Odd. When I get doc.Pages[0] it doesn't have a Form member. The test below fails. [TestMethod] public void pageFormExistsTest() { var doc = new PdfDocument(Path.Combine(OASISSettings.OASISRoot, "pdflibrary\\graphtest.pdf")); var mergeDoc = new MergeDocument(doc); Assert.IsTrue(mergeDoc is MergeDocument); Assert.AreEqual(2, mergeDoc.Form.Fields.Count); var page = mergeDoc.Pages[0]; var methodInfo = page.GetType().GetProperty("Form"); Assert.IsNotNull(methodInfo, "page doens't define a \"Form\" property"); }

Re: Form Filling

Support · Nov 5, 2009
Hello, The reason you are not seeing Form as the member of Pages is becasue it is a property directly off the PdfDocument object. You should be using the below code to get access to the Form property. doc.Form.Fields["XYZ"].GetX(page); Thanks, ceTe Software Support Team

Re: Form Filling

Forum member · Nov 5, 2009
Hmm. I'm trying that but don't seem able to get the right kind of "page" object that GetX() wants as its argument. According to the assembly, the signature is GetX(ceTe.DynamicPDF.Page), but that's not the kind of page object available from a PfdDocument. var d = new PdfDocument(path...); var p = d.Pages[0]; // p is a ceTe.DynamicPDF.Merger.Page // NOT a ceTe.DynamicPDF.Page.

Re: Form Filling

Support · Nov 5, 2009
Hello, The Page object used in the GetX() method is off the MergeDocument object and not the PdfDocument object. The flow should be as following: PdfDocument pDoc = new PdfDocument(@"C:\Temp\Test.pdf"); MergeDocument mDoc = new MergeDocument(pDoc); ceTe.DynamicPDF.Page page = mDoc.Pages[0]; float fltX = pDoc.Form.Fields["Test"].GetX(page); Thanks, ceTe Software Support Team