Hello again,
I've got a bit of a problem with FPDF and was hoping someone here might have experience with it to lend a hand.
Basically this is my code for handling the PDF generation...
session_start();
require('pdf/fpdf_extended.php');
if($_SESSION['PDFCodeType'] == "View")
{
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
$html='
<table>
<tr>
<td>Purchase Order No : '.$_SESSION['PODetails'][0]['PONo'].'</td>
<td></td>
</tr>
<tr>
<td>Purchase Order Date : '.date("d/m/Y",strtotime($_SESSION['PODetails'][0]['DateCreated'])).'</td>
<td></td>
</tr>
</table>
<br>
<hr></hr>
<br>
<table border="1">
<tr>
<td width="430" bgcolor="#d6eaef">Product Title</td>
<td width="110" bgcolor="#d6eaef">Price</td>
<td width="110" bgcolor="#d6eaef">Qty</td>
<td width="110" bgcolor="#d6eaef">Total</td>
</tr>'.
$_SESSION['PDFCodeItems']
.'<tr>
<td width="760" bgcolor="#d6eaef"> </td>
</tr>
<tr>
<td width="540"> </td>
<td width="110">Total</td>
<td width="110">£'.$_SESSION['PODetails'][0]['GrandTotal'].'</td>
</tr>
</table>
';
$pdf->Image('images/companylogo.jpg',168,5,0,18);
$str = utf8_decode($html);
$pdf->WriteHTML($str);
//$pdf->Output($name='invoice.pdf',$dest='D');
$pdf->Output();
}
if($_SESSION['PDFCodeType'] == "Download")
{
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',12);
$html='
<table>
<tr>
<td>Purchase Order No : '.$_SESSION['PODetails'][0]['PONo'].'</td>
<td></td>
</tr>
<tr>
<td>Purchase Order Date : '.date("d/m/Y",strtotime($_SESSION['PODetails'][0]['DateCreated'])).'</td>
<td></td>
</tr>
</table>
<br>
<hr></hr>
<br>
<table border="1">
<tr>
<td width="430" bgcolor="#d6eaef">Product Title</td>
<td width="110" bgcolor="#d6eaef">Price</td>
<td width="110" bgcolor="#d6eaef">Qty</td>
<td width="110" bgcolor="#d6eaef">Total</td>
</tr>'.
$_SESSION['PDFCodeItems']
.'<tr>
<td width="760" bgcolor="#d6eaef"> </td>
</tr>
<tr>
<td width="540"> </td>
<td width="110">Total</td>
<td width="110">£'.$_SESSION['PODetails'][0]['GrandTotal'].'</td>
</tr>
</table>
';
$pdf->Image('images/companylogo.jpg',168,5,0,18);
$str = utf8_decode($html);
$pdf->WriteHTML($str);
//$pdf->Output($name='invoice.pdf',$dest='D');
$pdf->Output($file = 'po'.$_SESSION['PODetails'][0]['PONo'].'.pdf', $download = TRUE);
}
I'm having to process everything on the page before and pass it through sessions because any processing on the page that isn't done by the FPDF class seems to make the page error.
$SESSION['PDFCodeItems'] is the HTML containing the table rows.
$SESSION['PDFCodeType'] is to find out whether the user is downloading or viewing.
I'm using an extended version of FPDF that converts basic HTML to PDF format. Which is attached for reference.
Like the title says it's purely IE7 that is just displaying nothing or not displaying a download dialogue box when the user clicks download. Works perfect in Firefox.
Any ideas?