Printer Friendly page

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all ,

 I have php page which the data in the page are extracted from MYSQL
The data are retrieved when user click submit button .
In the php page , there is a print button for user to print the php
Presently, i am using javascript window.print() which not an elegant

I tried to use CSS for printer friendly in php page , however i did not
know how to start.
Anyone have any idea how to , please share it with me .

- weetat

Re: Printer Friendly page wrote:

Quoted text here. Click to load it

Hi Weetat,

I always solve this the simple way:
1) Make a button: "Printer friendly page"
2) If somebody hits that button, simply create a popupwindow in which you  
retrieve the data again, and display it with little/no colors, just black  
and white.
From there you can call window.print() safely.

Alternatively, you can make a stylesheet for the printer, and tell the  
browser to use that (without the popupwindow). That should work too, but I  
prefer the first option because the user can see what will be printed  
beforehand excactly.

just my 2 cent.

Erwin Moller

Re: Printer Friendly page

On 2006-08-07, Erwin Moller wrote:
Quoted text here. Click to load it

Doesn't most browsers nowadays have a print preview function that takes
the CSS into consideration? I'm pretty certain that Firefox did last
time I checked.

    `^'                 Sanity is an illusion

Re: Printer Friendly page

Jesper H. wrote:
Quoted text here. Click to load it

Yeah, and I don't know how many times I've seen the previews of pages
that wouldn't print right :-)

I have to agree with Erwin. It's far easier to create a separate,
printable version of a page than having to come up with a stylesheet
that works for both screen and printer. And sometimes your printable
version will be structurally different from the screen version. For
on-screen viewing you might break a long article into multiple pages.
For printing you would want to output the whole thing.

Re: Printer Friendly page

Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Re: Printer Friendly page

Why don't you just use a @media print{} section in your CSS file?

Best regards wrote:
Quoted text here. Click to load it

Site Timeline