PseudoEvolution Posted July 13, 2008 Share Posted July 13, 2008 I have a script that generates a web page based on user input. The idea is to let people print this generated page, but I NEED the printed page to exclude the header/footer stuff (URL, Page #, Date etc...). I know this is possible if you configure the print settings manually, but users shouldn't have to do this, I want to do it with code some how. If it's not possible with code, how would you go about doing this? How could I get a web page to paper (with no header/footer info) as simple as possible? I thought about finding a way to convert it to PDF, but I don't know that there is an automated way to do this. Ideas? Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/ Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 Just have a link at the bottom like: <a href="page.php?version=printer_friendly">Printer Friendly Version</a> Then before you call your header check if version isset and if it is equal to printer_friendly, same with footer. If it is, then don't show them, if not, show the header and footer. Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588799 Share on other sites More sharing options...
PseudoEvolution Posted July 13, 2008 Author Share Posted July 13, 2008 Im not talking about HTML headers. Not the <head> stuff. I'm talking about the information displayed when you print a page. Like go to Print Preview and you will see what I mean. Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588805 Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 You can do it how i've suggested if you're using a templating system. It depends on how you're display everything. Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588807 Share on other sites More sharing options...
PseudoEvolution Posted July 13, 2008 Author Share Posted July 13, 2008 Just tried it... removing the <head> tags (and the <html> tags) doesn't remove the print headers. I'm pretty sure this is just a browser setting. If you still don't know what I'm referring to, see this screenshot of "Print Preview" for Yahoo Games. http://img300.imageshack.us/my.php?image=printexamplepu3.jpg Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588812 Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 That's not what I was suggesting... Your layout, you include the header like this: include("header.php"); And that draws the header, well maybe thats not how your doing it but this is just an example. Then, if printer_version as on, you'd hide that. Otherwise show it. Same goes for footer. Just depends how you've written it out. Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588814 Share on other sites More sharing options...
chronister Posted July 13, 2008 Share Posted July 13, 2008 I have accomplished this using a stylesheet specifically targeted for print..... <div id="header"> here is the header code </div> <div id="content"> Some content</div> <div id="footer">the footer</div> Add the stylesheet link in the header.... <link rel="stylesheet" type="text/css" media="print" href="print.css" /> print.css #header{ display:none; } #footer{ display:none; } Hope this helps... Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588816 Share on other sites More sharing options...
PseudoEvolution Posted July 13, 2008 Author Share Posted July 13, 2008 I don't know how else to explain this any easier... I'm NOT talking about web site headers. I know how to make a printer friendly version of a web page, but it will still show the printer headers. I'm talking about the text that is put there by the printer subsystem. It has nothing to do with web page styling. It is not the stuff before and after the body tags. It has nothing to do with html directly. Try to print anything from the web and the URL, Page #, and Date will show on the paper. I need to get rid of this. Perhaps a PHP forum isn't the place to post this. lol Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588818 Share on other sites More sharing options...
chronister Posted July 13, 2008 Share Posted July 13, 2008 AHHHHHHHHHH..... That is a user preference and I don't believe there is a way to manipulate the users browser preference... Those headers are put there by the browser / client, so server-side code (PHP) cannot do anything about that and I am skeptical to believe that JavaScript could even do that. That is a program setting that has nothing to do with the actual webpage being viewed. I may be wrong.... but on this issue I think your up shit creek. Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588821 Share on other sites More sharing options...
PseudoEvolution Posted July 13, 2008 Author Share Posted July 13, 2008 AHHHHHHHHHH..... That is a user preference and I don't believe there is a way to manipulate the users browser preference... Those headers are put there by the browser / client, so server-side code (PHP) cannot do anything about that and I am skeptical to believe that JavaScript could even do that. That is a program setting that has nothing to do with the actual webpage being viewed. I may be wrong.... but on this issue I think your up shit creek. I was afraid of this, but hey, at least you get what I'm talking about. I really don't have the option to completely ignore this, so now I just need an idea for getting the user to print this out. I wonder if there is a way to take the page contents and dump them in to a word document or PDF for the user to download, but I don't think it would retain the html formatting. ??? There's gotta be a way to do this...even if the user has to download a file. Link to comment https://forums.phpfreaks.com/topic/114503-printable-web-page-without-headerfooter-info/#findComment-588823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.