Not sure how PageInfo.PureHeight work

PureHeight documentation mentions “Gets or sets page pure height without margins.”. However, when running with this file attached here: example.pdf (75.2 KB), PureHeight outputs 698 while page height is 842. Thus it indicates that margin top is 2", but when you look at the pdf file, the margin top is definitely not 2".

Essentially, I’m jus trying to start extracting content without having to worry about the margin top or header, was thinking of using PureHeight as a start but now I’m not sure. I would really appreciate any help or guidance! Thank you :smiley:

@nnguyen9644

In order to get the height and width of a page in an existing PDF, it is recommended to consider the page rotation as well. Below code snippet considers the rotation and returns correct dimensions:

page.GetPageRect(true).Width;
page.GetPageRect(true).Height;

Thanks for your quick response! I ran with your given code:

page.GetPageRect(true).Width;
page.GetPageRect(true).Height;

which returns height of 842 while the height of the pdf page is also 842. So it seems like GetPageRect is not returning the right dimension without margin (PageInfo.Margin.Top indicates that there is 1" margin top) or heading. Is there a different way to get the dimension of the pdf page without margin or heading?

Thank you

@nnguyen9644

Would you please share the sample PDF for our reference as well? We will test the scenario in our environment and address it accordingly.

Hi, I have attached the file here example.pdf (75.2 KB)
, but you should also see it attached in my first post. Thank you!

@nnguyen9644

We apologize that the shared file was overlooked previously. Please also note that PureHieght property is used only for the Generator i.e. when contents of the new page is generated via Page.Paragrphs,.Add().
For existing document it is not easy to recognize heading and margin since PDF page does not have markup.

We have further logged an investigation ticket as PDFNET-51966 in our issue tracking system to analyze this case. We will look into its details and let you know as soon as we have some updates about ticket resolution. Please be patient and spare us some time.