how to print only the contents inside the div in A4 size from web pages.
someone please help me. I've almost completed my project.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Andrew FensterPosted May 3, 2011, 12:09 PM
http://www.princexml.com/doc/6.0/page-size/
Andrew FensterPosted May 3, 2011, 12:02 PM
Andrew FensterPosted May 3, 2011, 12:00 PM
The media="print" part tells the browser that this CSS only applies when printing.
If you only want to print the contents of one div, then you must use the CSS to hide everything else. You set everything else to display: none. For example:
#header, #footer, #navigation, #sidebar, button {display:none;}
If your html included sections with IDs of header, footer, navigation and sidebar, this would hide them during printing. It would also hide every section with a CSS class of button. You could modify this to hide everything you don't want to print.
While you're at it, you can set fonts, colors, or any other styles you want. These will only apply during printing.
Amit ChoudharyPosted May 3, 2011, 11:39 AM
Try something like this: