FPDF allows you a few options in outputting PDFs. You can force the download, save the file to a filesystem, or you can display them on the page, but what you can’t do is generate a PDF and show it inline.Here’s what you’ll do:
Create a new file (maybe, show_pdf.php):
require("…/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
if (preg_match("/MSIE/i", $_SERVER["HTTP_USER_AGENT"])){
header("Content-type: application/PDF");
} else {
header("Content-type: application/PDF");
header("Content-Type: application/pdf");
}
$pdf->Output();
You may need to pass in specific data parameters via $_GET to make this work right as you expand this code.
To show it on the page, you’ll do something like this:
else if ($cur_page == $no_of_paginations){
?>
<iframe src=“show_pdf.php?id=asdfasdf”></iframe>
<?php
}