Open yeshansachithak opened 5 years ago
Hi,
I'm using below code to generate PDF. Which works fine and saved to my location.
//convert to PDF try { if ($html_string !== "") { //Html2Pdf try { $html2pdf = new Html2Pdf('P', 'A4', 'en'); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->writeHTML($html_string); //$html2pdf->output($file_dir, 'F'); $html2pdf->output($file_dir, 'D'); } catch (Html2PdfException $e) { $html2pdf->clean(); $formatter = new ExceptionFormatter($e); echo $formatter->getHtmlMessage(); } } } catch (Exception $ex) { echo 'Error Message :: ' . $ex->getMessage(); die(); }
$html2pdf->output($file_dir, 'F'); works fine. When I use $html2pdf->output($file_dir, 'D'); It's show below error on my console.
$html2pdf->output($file_dir, 'F');
$html2pdf->output($file_dir, 'D');
How can I save and download the same generated PDF?
Please advice....
Hi!
Have you try to change the header?
header("Content-type:application/pdf"); header("Content-Disposition:attachment;filename='downloaded.pdf'");
Something like this?
Regards, LBF
Hi,
I'm using below code to generate PDF. Which works fine and saved to my location.
$html2pdf->output($file_dir, 'F');
works fine. When I use$html2pdf->output($file_dir, 'D');
It's show below error on my console.How can I save and download the same generated PDF?
Please advice....