Hi,
I am trying to create a pdf file from a image in the memory. Then i will just output the content directly to the web browser. Can anyone that a look at my code below and see if there is any mistakes?
Your kind attention is very much appreciated. Thanks.
$im = @imagecreate (50, 100);
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_begin_page($pdf, 612, 792);
$pim = pdf_open_memory_image($pdf, $im);
ImageDestroy($im);
pdf_place_image($pdf, $pim, 0, 0, 1);
pdf_close_image($pdf, $pim);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=test.pdf");
header("Content-length: " . strlen($data));
echo $data;