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

Free Support Forum - aspose.com

Improper PDF Template Field Page Number

Dear Support Team,

I’m using the following code to get a list of fields with theirs page number:

var template = new Form(document.Content);
return template
.Select(f =>
var facade = template.GetFieldFacade(f);
return new { Name = f, PageNumber = facade.PageNumber };

But the PageNumber is set to the number of pages in the document (attached).
Could you please let me know what is wrong with the code above?

Thank you,


Any news on the issue?


Hi Sergey,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please accept our apologies for a delayed response.

I tried your sample code with the latest version and did not find any issue. I am getting PageNumber =1 and which is correct as per your template file (please see the screenshot for reference). Please try the latest version of Aspose.Pdf for .NET and if you still face the same issue, please create a sample application and post it here. This will help us figure out the issue.

Thank You & Best Regards,

Hi Aslam,

Thanks for trying it out and I see the difference now - you use the Form class from the Aspose.Pdf.Facades namespace while I’m using one from Aspose.Pdf.Kit which doesn’t seem to be working with the latest libraries too.



One more question - how can I get template page size?
I’m trying PdfFileInfo GetPageHeight/GetPageWidth methods but they doesn’t seem to return correct values.
Is there any other way to retrieve it?

Thank you,

Hi Sergey,

Aspose.Pdf.Kit for .NET has been merged into Aspose.Pdf for .net and now you get the same set of features in Aspose.Pdf for .NET which were available in two different products.

Hi Sergey,

I am getting correct value from GetPageHeight method when tested with current latest version of Aspose.Pdf for .net.

//create PdfFileEditor object
PdfFileInfo pdfInfo = new PdfFileInfo("c:/input/Table.pdf");
MessageBox.Show("" + pdfInfo.GetPageHeight(1).ToString());


I would say that the Y field of the Box structure which is contained in the FormFieldFacade class is not calculated correctly.

It’s too far from the top for the document I attached above.

Could you please take a look at this particular document and let me know the figures you get and whether they’re correct or not?

Thank you,

Hi Sergey,

I am sorry I am unable to access the document that you have shared so I am unable to share my feedback over this matter.

I’ve attached it to my previous post.

Hi Sergey,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

I am able to access your template file successfully. I am not very clear about your requirement. Are you facing some issue in PdfFileInfo GetPageHeight/GetPageWidth or FormFieldFacades.Box? Please share some details about your issue. This way we can test the issue properly and get back to you soon.

Sorry for the inconvenience,

Hi Aslam,

Let’s take a look at the first field details I get using the FormFieldFacade class:
Caption = "Name (as shown on your income tax return)"
Box = {X = 57, Y = 683, Width = 518, Height = 14}
Now, let’s have a look at what PdfFileInfo GetPageHeight method returns: info.GetPageHeight(1) = 791.968

You can see that the field Y (top) coordinate looks to be closer to the bottom of the page, but if you open the template, you can see the field is located at the top of the first page.

Please let me know if I clarified things now.

Thank you,

Hi Sergey,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the details.

Actually, the value of fieldFacade.Box.Y is correct as the origin of the coordination is the lower-left corner of the page, so the Y coordinate of the name field from lower left corner is actually 638 (which is correct).

If you still have any confusion, please feel free to discuss.

Thank You & Best Regards,