Saving pdf file on server

5,758 views
Skip to first unread message

Qwickmalik

unread,
Aug 21, 2009, 10:33:28 AM8/21/09
to dompdf
Hi. Is there a way to save the new pdf file to the server instead of
producing a download dialog box? I'm using the dompdf class directly

i.e.

<?php
require_once("dompdf_config.inc.php");

$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");

?>

psychoactive

unread,
Aug 21, 2009, 1:05:25 PM8/21/09
to dompdf
Hey boy, try this:

$dompdf->render();
$pdfoutput = $dompdf->output();
$filename = $output;
$fp = fopen($filename, "a");
fwrite($fp, $pdfoutput);
fclose($fp);

Qwickmalik

unread,
Aug 22, 2009, 6:55:14 AM8/22/09
to dompdf
many many thanks. works perfectly.

Kavita Keshri

unread,
Oct 9, 2014, 1:22:56 AM10/9/14
to dom...@googlegroups.com, psycho...@gmail.com
But pdf is downloading on both server and local also... plz give me appropriate solution
Reply all
Reply to author
Forward
0 new messages