I'm able to generate a PDF with PHP using FPDF, but I'm trying to create an on-screen preview of the generated PDF rather than jumping straight to the online PDF viewer.
<?php
use setasign\Fpdi\Fpdi;
use setasign\Fpdi\PdfReader;
require_once('fpdf/fpdf.php');
require_once('fpdi2/src/autoload.php');
$pdf = new Fpdi();
$pageCount = $pdf->setSourceFile('pdf1.pdf');
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++)
{
$tplIdx = $pdf->importPage($pageNo);
// add a page
$pdf->AddPage();
$pdf->useTemplate($tplIdx, 0, 30);
$src = $target_file;
$pdf->Image($src,170,0, 30, 30);
}
$pdf->Output();
?>
The below code is what I've got at the moment, but i'm stuck on trying to generate it on the same page.
$pdf->Output();
The above segment seems to generate the PDF automatically onto a new page (opens online PDF viewer). I've searched through documentation and forums but can't seem to find anything.
Any help would be greatly appreciated. Thanks!