Skip to content Skip to sidebar Skip to footer

Pdf Not Store Inside The Folder Using Php

I tried to store my pdf file inside the folder in database.but it works only MAMP server.My code is below: $dompdf->load_html($html); $dompdf->set_paper('A4', 'landscape'); $

Solution 1:

Early in your code you call $dompdf->stream(). This method streams the PDF and halts execution of the script. I'm not sure why it's working on MAMP but not other servers, but if you re-arrange your script as such you should have more luck.

$dompdf->load_html($html);
$dompdf->set_paper("A4", "landscape");
$dompdf->render();

$canvas = $dompdf->get_canvas();
$font = Font_Metrics::get_font("helvetica", "bold");
$canvas->page_text(750, 570, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 6, array(0,0,0));
$canvas->page_text(25, 570, "II International P Ltd", $font, 6, array(0,0,0));
$output = $dompdf->output();

$file_to_save = '../files/'.$projectdetail->project_name.'/'.$projectdetail->project_name.'.pdf';
file_put_contents($file_to_save, $output);

$dompdf->stream($projectdetail->project_name." - Cost Report.pdf", array("Attachment" => false));

Post a Comment for "Pdf Not Store Inside The Folder Using Php"