I am using dompdf php lib for generating pdf.
Right now it ask user to save the file in their machine.
this is my code,
$dompdf->loadHtml("myhtml code is here");
$dompdf->render();
$dompdf->stream();
What i want is that when user click on the button, it should save the pdf in specific path in server.
How can we configure it.
Pls help.
Thanks in advance
+1
$dompdf->loadHtml("myhtml code is here");
$dompdf->render();
$output = $dompdf->output();
file_put_contents('filename.pdf', $output);
Questions should be asked on the user forum, not in the bug tracker.
The above code will upload to the remote location, however it is _also_ downloading the file as well. Is it possible to have it upload, and not download at the same time?
$dompdf = new Dompdf();
// $dompdf->loadHtml($html);
$dompdf->loadHtml(html_entity_decode($html));
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$output = $dompdf->output();
file_put_contents($filePath, $output);
@bdbolin that does not also send the file to the browser. $dompdf->stream() sends the file to the browser. $dompdf->output() only retrieves the source of the PDF.
Also, as mentioned in an earlier response, questions should be asked on the user forum, not in the bug tracker. You can always add links for context.
Most helpful comment
Questions should be asked on the user forum, not in the bug tracker.