Real dimensions (width - height) of A4

Dear all,

I have a PDF attached which, when opened on Acrobat Reader is clearly not an A4 (bigger than an A4) but when using Dimensions with Aspose and comparing to the Aspose.Pdf.PageSize.A4.Width and Height, it’s identified as an A4
Could anyone help me please?
Thanks a lot :slight_smile:
Document-Not-A4.pdf (171.2 KB)

@olivier.vermander,

We have tested your source PDF with the latest version 17.12 of Aspose.Pdf for .NET API and can retrieve the accurate width and height of the page (72 points = 1 inch). Please try the following code:

[C#]

string dataDir = @"C:\Pdf\test523\";
// Open document
Document pdfDocument = new Document(dataDir + "Document-Not-A4.pdf");
// Adds a blank page to pdf document
Aspose.Pdf.Page page = pdfDocument.Pages[1];
// Get page height and width information
Console.WriteLine("Width: " + Math.Round(page.Rect.Width/72, 2) + "  Height: " + Math.Round(page.Rect.Height / 72, 2));

Result (inch):

Width: 12.47 Height: 16.47

Hi and thank you very much for your answer !
Noted for the size of the PDF however standard size of A4 is 8.3 x 11.7 inch
And when comparing the initial width to the constant Aspose.Pdf.PageSize.A4 it seems ok for Aspose.
Does it mean that the Aspose const is wrong ?

Thanks,

@olivier.vermander,

When we open your source PDF document with Acrobat, then we can see the same Width and Height of the page in document properties. Please refer to this snapshot: image.png (1.4 KB)

Hello and thanks for your answer
Indeed that’s the right document dimension but my question is not there

Why Aspose comparison to the A4 width says OK even if 12.47 inch is not the Standard A4 Width ? Same question for height

Thanks a lot for your feedback,
Olivier

@olivier.vermander,

The constant Aspose.Pdf.PageSize.A4 width and height values are correct. How you are comparing A4 width and height values with actual page width and height. Kindly share the complete code, we will investigate and share our findings with you.