Hi guys,
I want to create a snippet for print a document become a hardcopy document.
I can use javascript function to print.
But the problem now is javascript will print a whole of html body so I want to catch the [*#content*] placeholder into the new page.
how to send the [*#content*] with a href or something so I can get a new page only with that content?
I’ve tried to send it with <a href="print.php?content=[*#content*]> but it didn’t work,
otherwise the content is appear twice.
Anyone can help me?
-
☆ A M B ☆
- 24,524 Posts
The proper way to do this nowadays is to create another .css file for print, and put a link to it in the template head, using
<link rel="stylesheet" type="text/css" href="path-to-css/print.css" media="print" />
Then in the CSS, simply hide the parts you don’t want to show with display:none; and set the fonts and sizes to those more appropriate to print.
http://www.alistapart.com/articles/goingtoprint/
http://www.alistapart.com/articles/alaprintstyles/
http://www.alistapart.com/articles/boom/
http://www.alistapart.com/articles/improvingprint/
http://www.alistapart.com/articles/printtopreview/
http://www.alistapart.com/articles/hiresprinting/
It can’t.
I have a menu sidebar, header and footer, and I don’t want to print them.
-
☆ A M B ☆
- 24,524 Posts
That’s why I posted the links to the most excellent articles in A List Apart; they explain clearly what is happening and how to do it.
Actually I just redevelop someone web into the new one.
But I don’t designed his web, I just use his css.
hmmmm, about the media type, when I use media=print
Will the print.css work automatically when I print it using javascript function?
I’ve read the article, but I don’t understand yet.