We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

To get the FormField Location in a word Document

Hi, I am integrating AdobeSign with my application. To place the signature block inside the document, adobeSign needs some parameters of RequestFormField -

height (double): Height of the form field in pixels,
left (double): No. of pixels from left of the page for form field placement,
pageNumber (int): Number of the page where form field has to be placed, starting from 1.,
top (double): No. of pixels from bottom of the page for form field placement,
width (double): Width of the form field in pixels.

reference - http://adobesign api reference

Is there any way to get the above parameters for formfield using aspose words.
Your help is appriciated.


Thanks for your inquiry. You can achieve your requirement using Aspose.Words.Layout API.

Please check the following code example. Hope this helps you.

Document doc = new Document(MyDir + "in.docx");
LayoutCollector collector = new LayoutCollector(doc);
LayoutEnumerator enumerator = new LayoutEnumerator(doc);

FormField formfield = doc.Range.FormFields[0];
enumerator.Current = collector.GetEntity(formfield);
Console.WriteLine("Page number : " + collector.GetStartPageIndex(formfield));
Console.WriteLine("Top : " + enumerator.Rectangle.Top);
Console.WriteLine("Left : " + enumerator.Rectangle.Left);