Hello .. Good night!
I have a need to find out if a particular PDF file looks like a landscape or portrait.
Is it possible, with the use of Spire.PDF, to know if a PDF is portrait or landscape?
Thank you in advance!
//Create a new instance of PdfDocument and load a PDF document from file.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("sample.pdf");
//Get the first Page
PdfPageBase page = pdf.Pages[0];
string orientation;
//If width > height, the orientation is "Landscape"
if (page.Size.Width > page.Size.Height)
{
orientation = "Landapace";
}
else//else the orientation is "Portrait"
{
orientation = "Portrait";
}
File.WriteAllText("result.txt", "Orientation = "+ orientation);