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 Document-Not-A4.pdf (171.2 KB)
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));
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 ?
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)
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.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.