Jump to content

Printable Web Page without Header/Footer Info


PseudoEvolution

Recommended Posts

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?

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.

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

 

 

 

 

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.

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...

 

 

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

 

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. :)

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.