Is there a way to specify the media type / page size to be used when the user prints a web page? Also, can I lay out text so it will be printed at specific positions?
For example, I’d like to render an address on a web page that the user can then print on a letter-size envelope.
Thanks!
EDIT
By media type, I meant the type of print media, such as letter-size, legal-size, #10 envelope, etc.
I think the bottom line is best use a PDF. Sadly, Browsers suck very much at printing.
You can specify a CSS style sheet to apply only to printing using
media="print". As to the page size, there is no reliable way of specifying that. You will have to rely on the user to do this for you.Also, you will have to rely on the user to remove the header and footer that most browsers add to the printed result.
In theory, yes. You can use physical unit values
cmorinto position elements on the page. I’m not sure whether these work with 100% reliability though, because printer specific margins may change the result – you’d have to test.