View Full Version : Print a printable version
08-15-2005, 12:48 PM
IŽd like to give the opertunity to send a printer friendly version of a page to the printer. I guess I should make another page or text/word/pdf/rtf-document. But then I donŽt know how to proceed. For example in this forum when you press the "show printable version" link it opens a .php file, but doesnŽt send it right away to the printer.
Please, can anyone help me?
08-15-2005, 12:53 PM
First of all it is probably a good idea to make a print version of your css file. Basically what this does is it enables you to style your content differently for printers than it does for viewing the pages in a browser.
This should get you started on making your website one of the most print-friendly in the biz. (http://www.meyerweb.com/eric/articles/webrev/200001.html)
08-15-2005, 01:06 PM
Thanks, the link was very interesting, but I now see I had to put my question a bit differently:
If anyone presses the link IŽd like to:
1. Open another page (with prtinter friendly styles) in a new (popup) window
2. Send it automatically to the printer
3. Let the window close automatically after the document is printed
I think if you really want to do it that way, I think you'll need to use a server side language because otherwise, the browser won't display it as it should print.
However, I agree with Tristan. I suggest that you make a separate stylesheet, (not too much effort as it would be based on your existing one), which would present to your printer, only the parts of the page that you want to print.
Then if you need to provide a preview, you can do it without causing an annoying pop-up window because, you can use the 'print preview' button in the browser.
PS. I may be wrong on this bit but, what you are trying to do involves controlling a user's PC. Otherwise, how would your page know when the page has printed.
08-15-2005, 02:34 PM
Unless you can't use a server scripting language the best would be to attach a print stylesheet. I have one on sites wich just display navigation, header, footer as none, etc, and there's general formatting in it (p, h[1-6], address, ul, ol, dl).
08-15-2005, 03:29 PM
As it happens I do have the possibility of using php. Although IŽm still a rooky at it.
You're right Bazz,I should refrase yet again:
3. Let the window close automatically after the print command is given
If I were to follow the restyle option is it to put all non printable parts in a <div class="noprint"> </div>???
well your stylesheet line could read like this for the print version
<link rel="stylesheet" href="LOCATION_of_your_cssFile" type="text/css" media="print">
It sounds to me like you shall have a button (printer friendly veriosn), which will open a window and then when they want to print they click a button in that new window print) which will close the window and print the page.
08-15-2005, 09:05 PM
Also, there is no way to automatically make something print, you can make the print dialog come up, but the user stills has to say "OK" before it will go to the printer. The reasons are fairly understandable, just imagine if you could do that, ads then could automatically print themselves to your printer for example.
08-16-2005, 12:50 PM
Sounds like fun to me! I personally will likely never bother with in-text links to print. I will make print stylesheets and figure that if the user can get to my page they know how to print it too.