I want to print the contents of a div(a table containing info) using jquery. I was wondering if it's possible to resize the table in order to use the who开发者_C百科le A4s width.
Thanks a lot
Do you mean you want to use a bleed to print right up to the edge of the page, or to simply have your navigation and other elements disappear so the width can take up the whole printing area (but still have page margins)?
I don't believe browsers support full bleed printing.
However, if you just want to use the full area with margins, most browsers should auto-size to the largest element on the page. So, use a print stylesheet.
- For testing, Firebug can conveniently show the print view in the browser, or you can simply remove the media="print"
- Hide other elements and make the
div
take up the full width of the viewport - Make sure to use
width:auto;
on that for best results. Since paper and screen are very different proportions, you don't want the browser mistakenly sizing-down your text because both are defined in pixels and it thinks you want it to preserve proportions.
精彩评论