itextsharp: what is the height of a regular PDF page in pixels?

Alex Gordon picture Alex Gordon · Dec 15, 2009 · Viewed 50k times · Source

What is the height of a regular PDF page in pixels?

I heard it was something like this:

Dim pgSize As New iTextSharp.text.Rectangle(595, 792)

but I am adding an image that takes up maybe half the height, and even though pgSize looks like a full page and the image takes up only half of it, I am getting a height of like 619 for the image?

I do not know if it is in the same units?

Answer

sbrogers picture sbrogers · Dec 15, 2009

Your page size depends on what you set it when you create the document, probably using the PageSize object (eg. PageSize.LETTER).

Once you've established that, most elements in iTextSharp use points and 1 in = 2.54 cm = 72 points.

So if you used a standard letter page (8.5x11) it would be 612 by 792.

I'm not sure I understand your second question about the image, but I believe that all the units in iTextSharp are points.