Hi, Eli,
Thank you for your response!
You can use the embedding APIs to integrate Gecko layout/printing
functionality into your own application. See
http://developer.mozilla.org/en/docs/Embedding_Mozilla . Alternatively,
you could make an XULRunner application which uses the printing APIs.
Is it possible to make Gecko to print the document layout exactly as
it's displayed on the screen? As far as I understand, normally Firefox
re-render layout to make it more printer-friendly (e.g. removes
backgrounds, rearranges objects, etc.), but I doesn't need this stuff.
Dumping a webpage to a PDF is not implemented. It actually wouldn't be
very hard to implement on the trunk, but nobody has done it. It could be
an interesting project to implement PDF dumping for webpages.
Hmm, I see. Actually, this feature can turn Gecko into typesetting
engine and it sounds cool. Not sure I'm ready now to start such a
project, so I'll try to find another ways to solve the problem. But I'll
write it to my long-term TODO list :)
An alternative if you're looking to dump screen output is to use
<canvas> with drawWindow and toDataURL to get a raster image of a
webpage using Gecko >= 1.8.1. Not especially pretty or fast, but doable.
It seems there's a problem with resolution. As far as I understand, by
default the engine assumes the output resolution is rather low (72 dpi),
but I need to prepare layout image to be printable in 300 dpi. E.g. if I
have a picture 2000x3000, the engine need to downscale it to show on the
screen (and this downscale information is normally written to <img> tag,
like <img width=600...>), but on print I doesn't need this downscaling.
Is it possible to specify the resolution of the canvas or something like
this?
And does I need to have some really visible canvas to dump the image, or
it can be done on invisible canvas?
--
With best regards,
Ilya V. Schurov.
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout