I’m trying to retrieve things like height, width, isLandscape, and rotation but it seems that when I load a document all these values are at a set value. No matter what PDF I load, it seems that pageinfo shows the height as 842 and the width as 595. I believe this is in points which would convert to an A4 size piece of paper. isLandscape is always false and rotation is always none.
Hi Rick,
Document pdfDocument
= new Document(myDir
- “TestLandscape.pdf”);<o:p></o:p>
//get page collection
PageCollection pageCollection = pdfDocument.Pages;
//get particular page
Page pdfPage = pageCollection[1];
//To considering rotation in page width and height info
Aspose.Pdf.Rectangle rect = pdfPage.GetPageRect(true);
//get page properties
Console.WriteLine("Page {0} width is {1} and heigth is {2}, rotation: {3}, size considering rotation: widht {4} : height {5}",
pdfPage.Number, pdfPage.Rect.Width, pdfPage.Rect.Height, pdfPage.Rotate.ToString(), rect.Width, rect.Height);
Console.ReadLine();
The issues you have found earlier (filed as PDFNEWNET-35879) have been fixed in Aspose.Pdf for .NET 8.7.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi,
I can reproduce the original problem in PDFNEWNET-35879, that should be fixed in .Net 8.7.0 in Version 19.4.0.
Maybe regression.
Thank you for contacting support.
Please try using below code snippet to read width and height of pages:
Document document = new Document(dataDir + "Test.pdf");
PdfFileInfo info = new PdfFileInfo(document);
Console.WriteLine("Width: " + info.GetPageWidth(document.Pages[1].Number));
Console.WriteLine("Height: " + info.GetPageHeight(document.Pages[1].Number));
OR
Console.WriteLine("Height: " + info.GetPageHeight(1));
We hope this will be helpful. If you still notice any problem then please share narrowed down code snippet along with source document so that we may investigate further and help you out.