Page Orientation,Portrait,Landscape

When importing pdf with Aspose.Pdf.Document(pdfFilePath). I want to know if the pdf is portrait or landscape.
I use,
var pdf = new Aspose.Pdf.Document(pdfFilePath);
var landScape = pdf.PageInfo.IsLandscape;
When I select a portrait document or a landscape document, both return false values.

I would be glad if you can help. Good work.

@hvkktr
The PageInfo properties Width, Height, IsLandscape are intended for using a pdf file generator and are not filled in when reading file. (This is indicated in the description of these fields)
To reliably determine the orientation of the page, use the MediaBox property of the page.
If the width there is less (or equal) than the height, the page has a portrait orientation, otherwise landscape.
Page sizes can be determined using UserUnit (if specified) and MediaBox.Width, MediaBox.Height.

using (Document document = new Document(fileName))
{
    foreach (Page page in document.Pages)
    {
        var pageMediaBox = page.MediaBox;
        var isLandscape = pageMediaBox.Width > pageMediaBox.Height; // reliably determined.

        double userUnit = 72.0; // pixels per inch
        if (page.EnginePage.PageInformation.UserUnit != null)
        {
            userUnit = 72.0 * page.EnginePage.PageInformation.UserUnit.ToDouble();
        }

        double k = 25.4 / userUnit;
        var pageWidth = k * pageMediaBox.Width;
        var pageHeight = k * pageMediaBox.Height;

        Console.WriteLine("Height: " + pageHeight + ", Width: " + pageWidth + ", Landscape: " + isLandscape);
    }
}

Many thanks for your return. I tried, it worked… :slightly_smiling_face: