views:

468

answers:

1

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?

+4  A: 

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.

sbrogers
im having kind of a horrific time with this, im subtracting the heights of images each time from 792
I__
btw you sure its not 595 not 612?
I__
Well, 8.5*72 = 612, but in reality you may have margins so the "usable" part of the page may be less than 612.If you can get your hands on a copy of the book iText in Action, I found it really helpful when I was first learning iText. And checking out some of their stuff in reflector is always helpful too.
sbrogers
i dont know if it would be much help all examples are in java
I__
I found the examples close enough to c# to still be useful, as are the overall concepts presented.
sbrogers