how can i set base path to save created file

1,475 views
Skip to first unread message

irshad

unread,
Mar 15, 2010, 6:41:03 AM3/15/10
to dompdf
please help me all,

i am new user of dompdf

how can i set the directory path to save pdf generated file and
attache to send mail

Paul Waring

unread,
Mar 15, 2010, 12:12:20 PM3/15/10
to dom...@googlegroups.com
irshad wrote:
> how can i set the directory path to save pdf generated file and
> attache to send mail

If you want to save a file you need code like this:

$html = ''; // load your HTML into this variable
$filename = '/path/to/pdffile.pdf';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper('a4', 'portrait'); // change these if you need to
$dompdf->render();
file_put_contents($filename, $dompdf->output());

You will need to make sure that the web server (or PHP if you're running
on the command line) has permission to write to the directory where you
want to store the file.

As for attaching files to emails, there are a number of ways in which
you can achieve this. Personally I prefer to use the addAttachment
method of the PEAR::Mail_Mime class:

http://pear.php.net/manual/en/package.mail.mail-mime.addattachment.php

--
Paul Waring
http://www.pwaring.com

Reply all
Reply to author
Forward
0 new messages