Generate HTML code that includes two stylesheets. One for screen and another one for Print.
or say like below
style .............. /style
style media="print" ........ /style
body{
font-family:serif
}
.new-next, .new-print-btn{
display:none;
}
a:after { content:' [' attr(href) '] '}
The first style is for "Screen" (by default if do not specify one..)
Things to be noted in "Print"
Fonts should be serif (not sans-serif) for printing
Hide images as much as possible
Hide ads
Hide navigational elements
Use a black-on-white colour scheme
Underline links if any
Add the actual URL to your links (see below)
To add the actual URL in the href-part of your link to the name of your link add the following to you print stylesheet:
[css]a:after { content:’ [' attr(href) '] ‘}[/css]
Final thing add "javascript:print()" to the button
input type="button" value="Print" onclick = "javascript:print()"
[Ref: http://ariejan.net/2007/01/19/print-this-page-with-ruby-on-rails/ ]
No comments:
Post a Comment