vendredi 27 octobre 2017

How to save PDF_HTML file to FPDI Object?

Created PDF page using HTML table by an external class called WriteHTML, also using FPDI to add pages to my pdf template, now I need to add the generated HTML table pdf to my template.

I am doing both processes in a different Class call.

Example:

$uniqid = uniqid();

$pdfHTML = new \PDF_HTML();
$pdfHTML->AddPage();
$pdfHTML->SetFont('Arial');
$table = $pdfHTML->WriteHTML('You can<br><p align="center">center a line</p>and add a horizontal rule:<br><hr>');
$table = $pdfHTML->Output(); // * Success - my table PDF Generation.

$pdf = new \FPDI();
$numPages = $pdf->setSourceFile(public_path('reports/my-template.pdf'));
$pdf->AddPage();
$rp = $pdf->importPage($table); // here i am trying to get PDF_HTML
$pdf->useTemplate($rp, 0, 0, 210);
$path = public_path("reports/".$chartId."-".$uniqid.".pdf");
$pdf->Output($path,'F');
header('location:'.$path);

return "http://".$_SERVER['HTTP_HOST']."/MyProject/public/reports/".$uniqid.".pdf";



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zbAZvS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire