As a web systems programmer, I'd like to generate some reports and be able to send it to the printer directly from my user's browser, wich is in the client side, not needing to generate PDFs or something like this.
I would like to be able to:
Is all this possible? Javascript? CSS? What are the best practices here?
Right-click the report in the connection tree and choose Print Report As -> PDF/HTML/Excel/Archive.
All those things are controlled exclusively through browser preferences. If you want to be able to specify that, then you probably should be looking at PDF instead of HTML.
You're out of luck using the browser there... I think it is impossible to not print in the corners the URL, Date/Time Accessed etc.
However, Page 1 or 3 etc is generally always printed somewhere (bottom right corner I believe in FireFox)
Printing a 'Generated in 2009-02-20' is easy enough, however printing it at the bottom of every page will be difficult. Most browsers, IIRC, display the date and time accessed in a corner (though not in that format, in a more readily human readable format).
Anything you want to appear in print but not in the normal screen view, will need to be shown using a print stylesheet.
For what you want here (complete control of the printing output), I'd recommend generating a PDF. Perhaps if this is an internal tool, you might be able to program a plugin for Firefox that may print your pdfs automatically, but I'm not that familiar with the capabilities of Firefox plugins so you'd need to experiment.
Support from different browsers is surely lacking, but css has a media type called print, to use it, just define a section in your css file or tag like this:
@media print{
/* normal style declarations
but you probably want to hide menus
and other navigation, also use black on white, etc.
*/
}
@media screen{
/* your current stylesheet */
}
This List Apart article covers the basics.
And here's an entry point to the wc3 specification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With