Fatal error using FPDF:Some data has already been output, can't send PDF file?
<p>when I am trying to create the PDF file I got the following Error?<br/>
I dont know why and I dont know how to fix it?
The Error is look like below <br/>
`</p>

<pre><code>Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\phpexample\createpdf.php:1) in C:\xampp\htdocs\phpexample\fpdf16\fpdf.php on line 1017`&lt;br/&gt;
`FPDF error: Some data has already been output, can't send PDF file`&lt;br/&gt;
</code></pre>

<p>My  coding is like this</p>

<pre><code> &lt;?php
 include_once('fpdf16/fpdf.php');$pdf=new FPDF();

$pdf-&gt;AddPage();
$reportdate = date('d-m-Y H:i:s');
$filename = $reportdate.'_report.pdf';
$pdf-&gt;SetFillColor(255,0,0);
$pdf-&gt;SetTextColor(255);
$pdf-&gt;SetDrawColor(128,0,0);
$pdf-&gt;SetLineWidth(.3);
$pdf-&gt;SetFont('Arial', 'B', 6);
// Header
$header=array('Member Card No','Full Name','Description', 'Start Date', 'Expiry Date', 'ramount', 'Address1', 'Address2');
$w = array(25, 35, 35, 15, 18, 15, 30, 30);
for($i=0;$i&lt;count($header); $i++)
        $pdf-&gt;Cell($w[$i],7, $header[$i], 1, 0, 'L', true);

$pdf-&gt;Ln();

// Reset colour set for data 
$pdf-&gt;SetFillColor(224,235,255);
$pdf-&gt;SetTextColor(0);
$pdf-&gt;SetFont('courier','',7);
$fill=false;
$resultcount=8;
for($i=0;$i&lt;$resultcount;$i++)
{
        $height =6;
        $pdf-&gt;Cell($w[0], '$height', 'CardNoishai', '1', '0', 'L', $fill);
        $pdf-&gt;Cell($w[1], '$height', 'Vinoth', '1', '0', 'L', $fill);
        $pdf-&gt;Cell($w[2], '$height', 'Sample PDF', '1', '0', 'L', $fill);
        $pdf-&gt;Cell($w[3], '$height', date('m-d-y'), '1', '0', 'L', $fill);
        $pdf-&gt;Cell($w[4], '$height', date('m-d-y'), '1', '0', 'L', $fill);
        $pdf-&gt;Cell($w[5], '$height', 'test', '1', '0', 'L', $fill);
        $pdf-&gt;Cell($w[5], '$height', 'test', '1', '0', 'L', $fill);
        $pdf-&gt;Cell($w[5], '$height', 'Add2', '1', '0', 'L', $fill);
        $pdf-&gt;Ln();
        $fill = !$fill;

}       
$pdf-&gt;Cell(array_sum($w),0,'','T');
$pdf-&gt;Output($filename, 'I');
?&gt;
</code></pre>
