When I create PDF in PHP, how do I get the browser to render it correctly?
- by pavun_cool
I have used following code to create a simple PDF file. It executes fine in browsers, but I am not able to get the PDF file. It gives me some output when I am running the code in the CLI; my doubt is where I specify the PDF's filename.
<?php
require('fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
CLI output:
2 0 obj
<< /Type /Page
/Parent 1 0 R
/Contents 3 0 R
endobj
3 0 obj
<< /Length 4 0 R
stream
2.834646 0 0 2.834646 0 841.9 cm
2 J
0.2 w
BT /F1 5.64 Tf ET
BT 11 -16.692 Td (Hello World!) Tj ET