Skip to content Skip to sidebar Skip to footer

R&os Pdf In Php (name Of Pdf)

anyone uses this function to create PDF in PHP? http://www.ros.co.nz/pdf/ I need set the name of this pdf, and I don't find the option. The name is the same of the current page; fo

Solution 1:

Don't use $pdf->ezStream() or $pdf->stream(), use $pdf->output() instead. Try to add following codes to the bottom of your PHP code:

header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename=yourfilename.pdf");
print$pdf->output();

Hope it helps.

Solution 2:

Apparently, the filename can only be set via http headers and the author of the library is not sure whether it works or not. The documention for stream() states:

The options array can be used to set a number of things about the output:

'Content-Disposition'=>'filename' sets the filename, though not too sure how well this will work as in my trial the browser seems to use the filename of the php file with .pdf on the end.

Solution 3:

This might work (not tested though):

Based on the FAQ, $pdfcode = $pdf->ezOutput(); makes the PDF's code itself. Write it to a whatever.pdf file where whatever is the desired file.

Solution 4:

The documentation said to do like this: $pdf->ezStream(array('filename'=>$nome,'compress'=>0)); but, nothing happen for me.

Post a Comment for "R&os Pdf In Php (name Of Pdf)"