Page 1 of 1
FPDF
Posted: Thu Jul 26, 2007 1:06 am
by guitarlvr
I'm fiddling around with FPDF and am running into a problem. I'm walking through the tutorials on their site, the simplest one there is. I copied and pasted it into a php file on my server and included the fpdf.php file. When i run it, it should open acrobat and display hello world however it tells me that headers have already been sent to the browser and cannot open the file. The error is that of the included file (fpdf.php) sending headers to the browser. does anyone know how to overcome this issue?
Posted: Thu Jul 26, 2007 1:07 am
by John Cartwright
You cannot mix the two streams together.. therefore you cannot have any output prior to sending the headers. How to solve it? Do not have any output prior to creating the pdf.
Posted: Thu Jul 26, 2007 1:10 am
by guitarlvr
I'm not outputing any headers. The required file used to create the pdf is what is outputing the headers. this is my php file:
Code: Select all
<?php
require('./fpdf153/fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
Posted: Thu Jul 26, 2007 1:13 am
by John Cartwright
There are a couple reasons you might be getting the error then.. make sure you have no whitespace outside your <?php ?> tags, secondly you can try copy+paste your script into notepad and overwritting the file since hidden characters may have crept into the file.