Ninjakreborn Posted February 21, 2007 Share Posted February 21, 2007 I have seen links that said click here to print. When they are clicked it activates your printer. How is this setup, PHP, or something else. Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/ Share on other sites More sharing options...
ted_chou12 Posted February 21, 2007 Share Posted February 21, 2007 try this: <input type="Button" name="printit" value="print" onclick="javascript:window.print();"> found here: http://www.developer.be/index.cfm/fuseaction/faqDetail/FaqId/135.htm Ted Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-190532 Share on other sites More sharing options...
craygo Posted February 21, 2007 Share Posted February 21, 2007 damn beat me to it Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-190534 Share on other sites More sharing options...
ted_chou12 Posted February 21, 2007 Share Posted February 21, 2007 Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-190535 Share on other sites More sharing options...
scottybwoy Posted February 21, 2007 Share Posted February 21, 2007 Is there a way to make it print out a printer friendly version? Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-190556 Share on other sites More sharing options...
Ninjakreborn Posted February 21, 2007 Author Share Posted February 21, 2007 Ah, this is perfect. Thank you. In order to get a printer friendly version, that can be setup with a .css file. Have the CSS as media type print. Then style it to look good in a printer. Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-190572 Share on other sites More sharing options...
scottybwoy Posted February 22, 2007 Share Posted February 22, 2007 How do you mean? <input type="Button" name="printit" class="print" value="print" onclick="javascript:window.print();"> or use onclick="javascript:printversion();" Then have that change the css source for the page and print? Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-191356 Share on other sites More sharing options...
Ninjakreborn Posted February 22, 2007 Author Share Posted February 22, 2007 No, the print he showed me just makes the print screen come up. It activates the printer on there browser to start up the printer, it does nothing to style the page for printing. If you want a page that prints right, you need to create a CSS file. Attach it to the document using the media type "print" it makes it become ignored UNLESS the browser is in print view, and is printing the document. The point of this is to remove things you don't want part of the printing (hiding certain things). Or making it look good for black/white only printers by removing clashing colors. As well as removing unnecessary components that will jsut clutter the printer (navigation, header, footer, whatever else might be obtrusive to simply printing the data). Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-191367 Share on other sites More sharing options...
scottybwoy Posted February 22, 2007 Share Posted February 22, 2007 OK I understand now, thanks. You have two css files for the page : <link rel="stylesheet" type="text/css" href="../httpd/styles/style.css" /> <link rel="stylesheet" type="print" href="../httpd/styles/print.css" /> Like so. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-191375 Share on other sites More sharing options...
Ninjakreborn Posted February 22, 2007 Author Share Posted February 22, 2007 Right, the original css file is the original styling. It is always active. However when in print mode the print one takes over. It does not erase the first, but the idea is behidn the "cascading". It basically overwrites (it takes priority) over any styles in the first one when in print mode. So you need to always have the print one BELOW any others. That way it can overwrite anything in the other files, and it makes sure it takes priority. Quote Link to comment https://forums.phpfreaks.com/topic/39490-solved-click-here-to-print/#findComment-191411 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.