I don't know why I found it so hard to get hold of this information. I've placed it onto my blog for reference purposes. As before, if you can suggest a better method of doing this please leave a comment.
1: public string GetPageSize(string PathToPDF)
3: var reader = new PdfReader(PathToPDF);
5: // A post script point is 0.352777778mm
6: const float postScriptPoints = (float)0.352777778;
8: // The height and width are returned in post script points from iTextSharp
9: float height = reader.GetPageSizeWithRotation(1).Height * postScriptPoints;
10: float width = reader.GetPageSizeWithRotation(1).Width * postScriptPoints;
14: if ((width >= 210 && width < 211)
15: && (height >= 297 && height < 298))
17: return "A4";
20: return "unknown page size";
Welcome to my blog, I'm a bit of a technology geek and have been in the coding/ developer/ consultancy arena for over 10 years.
I love coding, solving problems and tinkering with new technology - you could say I am passionate about technology :)
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in anyway.
Page rendered at Tuesday, 21 February 2017 01:31:53 (GMT Standard Time, UTC+00:00)