GetX() and GetY()

GetX() and GetY()

Forum member · Dec 11, 2006
I am importing an existing pdf document with two pages with form fields on each page using the ceTe.DynamicPDF.Merger.PdfDocument Class and then trying to get the x and y coordinates of each form field. I need to get locations of the form fields so that I can dynamically generate a form in my program that will have the textboxes to fill in the values for the form fields in the correct order as laid out in the existing pdf. Ideally I would love to have been able to read the tab orders of the form fields to establish their correct order, but I was informed that this product cannot get the information from the pdf. As such, I have decided to use the coordinates of the form fields to get their layout and order my input textboxes this way. Currenty it seems that the form field list is generated in the order that they were last modified in the pdf. Being able to correctly order these is essential. Information about the form fields is not known in advance by my program as they may change from pdf to pdf. I am having trouble using the code below: Dim myPdfDocument As PdfDocument myPdfDocument = New pdfDocument(pathToMyPdfFile) Dim I As Integer For I = 0 To fieldList.Count - 1 Dim xCoord As Single = 0.0 Dim yCoord As Single = 0.0 Dim pageIndex As Integer = fieldList(I).GetOriginalPageNumber - 1 xCoord = fieldList(I).GetX(myPdfDocument.Pages(pageIndex)) yCoord = fieldList(I).GetY(myPdfDocument.Pages(pageIndex)) Next I get the error: Value of type 'cete.DynamicPDF.Merger.PdfPage' cannot be converted to 'ceTe.DynamicPDF.Page' It seems that the GetX and GetY functions of the pdfFormField object will not work with the

Re: GetX() and GetY()

Support · Dec 11, 2006
Hello, You can get the X and Y coordinates by using the following sample code. PdfDocument mPdfpage = new PdfDocument("D:\Attachments\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.