What is the mapping of pixels in html to pdf

476 views
Skip to first unread message

Vivek Gupta

unread,
Nov 26, 2011, 11:05:22 AM11/26/11
to Flying Saucer Users
I am confused on a very basic question --

- What is the dimension of a page say 8.5x11 inch in pixels? Can I simply use 72 dots-per-inch, and assume it is 612x792 pixels?
- What is the translation from html pixel width to pdf page? When I specify a font size to be 14px, would it translate to 14/72 inches?
Thanks
Vivek


Peter Brant

unread,
Nov 27, 2011, 4:13:48 AM11/27/11
to flying-sa...@googlegroups.com
The default is 96 px per inch (which is also specified in the CSS
spec), but this can be customized with the dotsPerPoint and
dotsPerPixel parameters to the ITextRenderer constructor.


(from ITextRenderer)

// These two defaults combine to produce an effective resolution
of 96 px to the inch
private static final float DEFAULT_DOTS_PER_POINT = 20f * 4f / 3f;
private static final int DEFAULT_DOTS_PER_PIXEL = 20;

Pete

Vivek Gupta

unread,
Nov 27, 2011, 9:03:30 PM11/27/11
to flying-sa...@googlegroups.com
Thanks Peter! This is very helpful.
Vivek
Reply all
Reply to author
Forward
0 new messages