Jump to content

Is there a way to not print Headers and Footers?


Matt Ridge

Recommended Posts

When using Firefox and other browsers they put in the header and footers the information in the page when you print, is there a way through PHP to actually not allow  those to be printed or is this a manual option that is going to have to be selected every time I want to print?

Are you talking about the URL and page x of x that the browser adds when you print? If you are, every browser I've used has a setting to allow you to shut that off. As far as doing that in php, no you can't.

Right, if you are talking about the headers/footers that the browser inserts the answer is no since PHP has no ability to control what the browser does with the rendered page. However, if you are talking about headers/footers that YOU are putting on your web page and you don't want them displayed if the user prints the page. Then you can use the "@media" control within CSS to define different styles based upon whether the page is viewed in a browser or printed. Just set the display property to none within the "print" media type for those elements you do not want displayed in a printed page.

Are you talking about the URL and page x of x that the browser adds when you print? If you are, every browser I've used has a setting to allow you to shut that off. As far as doing that in php, no you can't.

 

Dang, I'm getting a form to show to the Mgt. and honestly I don't need user error to print and show those headers and footers... as most people know the Mgt are the type of people that just don't know how to do the simplest of things unless they are IT, and even then...

Indeed. Making PDFs with PHP is easy

 

<?php
require('fpdf.php');

header( 'Content-type: application/pdf' );

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Helvetica','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>

Using: http://www.fpdf.org/

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.