Hi I am getting wrong information reported back for a pdf document. I have included the code, document and expected vs actual results. In short the pdf document read by Aspose is not reporting the width/height, or is landscape properly.
Here are the results:
Expected Output:
Page: 1
Width: 11.69
Height: 8.26
Is Landscape: true
Page: 2
Width: 8.5
Height: 11
Is Landscape: false
Page: 3
Width: 11
Height: 8.5
Is Landscape: true
Actual Output:
Page: 1:
page.PageInfo.Width: 8.26388888888889
page.Rect.Width: 8.26388888888889
Height: 11.6944444444444
page.Rect.Height: 11.6944444444444
Is Landscape: False
Page: 2:
page.PageInfo.Width: 8.26388888888889
page.Rect.Width: 11
Height: 11.6944444444444
page.Rect.Height: 8.5
Is Landscape: False
Page: 3:
page.PageInfo.Width: 8.26388888888889
page.Rect.Width: 8.5
Height: 11.6944444444444
page.Rect.Height: 11
Is Landscape: False
ToAspose.zip (460.8 KB)
@ccuster68
Thanks for contacting support.
We have logged an issue as PDFNET-47762 in our issue tracking system after observing it in our environment with Aspose.PDF for .NET 20.2. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us little time.
We are sorry for the inconvenience.
Hello, There has been no feedback on this in over 2 years. I have ran across another example of this behavior. Please investigate. This is tested with Aspose.Pdf 22.2.0
PDFWrongDimensions.zip (52.3 KB)
@ccuster68
We apologize for the delay. Can you please use the below code snippet along with 22.5 version of the API and see if you get the expected results?
var wo = doc.Pages[1].GetPageRect(true).Width;
var ho = doc.Pages[1].GetPageRect(true).Height;
Please note that the Document.PageInfo is for the usage while PDF generation only. In case of existing PDF, correct way to find the existing dimension is like above.
Thank you Asad, That retrieved the correct results.
1 Like