On 06/27/2012 08:21 AM, Ben Bucksch wrote:
I am unclear about gecko's dpi handling while printing.

I need to have the webpage rendered with 600 dpi, i.e. an image with 600 pixels 
width should print with 1 inch width.
Currently, the engines assumes web-like 100 dpi and prints in 6 inches.
In my case, it's not a static <img>, but about a <div> that's built by JS. When 
the JS on the webpage asks about the size of
the <div> in px, it must get 3000px as answer, but the <div> must print in say 
21cm, printing these 3000px in these 21cm width.

pref("layout.css.dpi", 600); (I'm in XULRunner) sounds like what I need, but it 
doesn't help.
I tried <container style="width: 20cm"><div 
style="3000px">...</div></container>, but that doesn't work, it causes overflow.
Also, printSettings.shrinkToFit = true; and 
printFrame.markupDocumentViewer.fullZoom = 10; don't help.

I lack background knowledge about the layout engine to know how to approach 
this problem. Can somebody please point me in the
right direction?

In CSS, the ratio of px to cm is fixed, so for a 600px image you want printed 
at 600dpi,
size your image as 1in, rather than as 600px, and it should print properly.

~fantasai
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to