Posted by a ceTe Software moderator
Hello Dan,
You can get the X, Y, Height and Width of the existing form field by using the GetX, GetY methods and the Height and Width properties of the PdfFormField class. Following is some sample code for this. Please find the attached PDF we used for this.
PdfDocument pdf = new PdfDocument(@"C:\Temp\test.pdf");
MergeDocument doc = new MergeDocument(pdf);
float x = pdf.Form.Fields["txt"].GetX(doc.Pages[0]);
float y = pdf.Form.Fields["txt"].GetY(doc.Pages[0]);
float width = pdf.Form.Fields["txt"].Width;
float height = pdf.Form.Fields["txt"].Height;
doc.Pages[0].Elements.Add(new Label("X: " + x.ToString() + " Y: " + y.ToString() + " Width: " + width.ToString() + " Height: " + height.ToString(), 10, 70, 200, 20));
doc.DrawToWeb();
Thanks,
ceTe Software Support Team