[Project_owners] Manipulate printing output?

Karsten Düsterloh mnenhy at tprac.de
Thu Dec 9 21:40:02 EST 2004


Malte Rücker aber hob zu reden an und schrieb:
>> You can overlay stylesheets in the same manner as overlaying content.
>> For example, see
>> http://lxr.mozilla.org/mozilla/source/extensions/irc/xul/skin/contents.rdf#22
> 
> But userContent.css isn't explicitly included in any of the *.xul files,
> so which one should I overlay? The message is contained in a <browser>
> element (like in Firefox) and as far as I know it is not possible to
> apply overlayed css to its contents (?).

Yeah, you're right. It seems as if both user stylesheets are not
respected when printing (at least with mail; I didn't test with the
browser). :(

> This takes me back to my initial question, is it possible to apply 
> styles to what will be printed?

Yes, but it's only a kind of elaborate workaround I found.

> So far, I know that stuff from 
> userContent.css will be respected but as already said I cannot change 
> its contents from an extension (and I even don't want to do it this 
> way). Everything else failed, it seems that the printing system is a 
> black box that can't be manipulated by extensions/overlays etc.

When I manipulate the print preview with the DOM Inspector, my
manipulations are printed. So you could do this:

Require the print preview to be used; overlay it with your code.

The print preview contains - as you said - a <browser> element that will
contain the document to be printed. You have access to its #document via
its contentDocument property. You then could add a custom
 <link rel="stylesheet" href="your stylesheet">
to the document's <head> element...


Karsten
-- 
Feel free to correct my English. :)


More information about the Project_owners mailing list