Re: printable page

From: Date: Mon, 07 Apr 2003 13:57:05 +0000
Subject: Re: printable page
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142699@lists.php.net to get a copy of this message
Don't send msword headers if you don't want it to try and open Word. Plain and simple. Just use some CSS to make a printer friendly HTML page. Add some Javascript to save the page (on their prompt). ---John Holmes... ----- Original Message ----- From: "Edward Peloke" <epeloke@echoman.com> To: "Php-General@Lists. Php. Net" <php-general@lists.php.net> Sent: Monday, April 07, 2003 9:23 AM Subject: [PHP] printable page > Hello all, > > I have a site which generates a 'quote' for the user for a chartered flight. > I would like to also generate a page that they can print off or save. I do > not have acrobat to create a pdf so I was just thinking of creating and rtf > for them. I took the following code from 'PHP and MySQL Web Development' > but everytime I try to load it, it wants to install ms office 2000. Can I > change the content-type so that the user does not need word but can still > view it in the browser? > > Thanks, > Eddie > <? > //generate the headers to help a browser choose the correct application > header( "Content-type: application/msword" ); > header( "Content-Disposition: inline, filename=cert.rtf"); > > $date = date( "F d, Y" ); > > // open our template file > $filename = "PHPCertification.rtf"; > $fp = fopen ( $filename, "r" ); > > //read our template into a variable > $output = fread( $fp, filesize( $filename ) ); > > fclose ( $fp ); > > // replace the place holders in the template with our data > $output = str_replace( "<<NAME>>", strtoupper( $name ), $output ); > $output = str_replace( "<<Name>>", $name, $output ); > $output = str_replace( "<<score>>", $score, $output ); > $output = str_replace( "<<mm/dd/yyyy>>", $date, $output ); > > // send the generated document to the browser > echo $output; > > ?> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#142699) next »