How to get Page format?


Product Version:

Is it possible to get page format (A0,A1–A4) out of the box?


Are you wanting to create a page of a given format?

Please take a look at the following article:

Please let me know if this works for you

I have logic like if incoming PDF is A0, A1, A2, A3, A4 then I should stamp data on it.

Currently I checking this way.

		private bool CheckFormat(string fullName)
			using (PDFDoc doc = new PDFDoc(fullName))
				double height = doc.GetPage(1).GetPageHeight();
				double width = doc.GetPage(1).GetPageWidth();
				double widthMM = width * 25.4 / 72;
				double heightMM = height * 25.4 / 72;
				return (widthMM > 209 && heightMM > 296) || (heightMM > 209 && widthMM > 296);

Your logic looks reasonably correct.

Since PDF page sizes can be any size, it requires similar logic to determine a given paper size.