PDF extention has been installed:
PDF Support: enabled
PDFlib GmbH Version: 5.0.3
PECL Version: 2.1.0
Revision: $Revision: 1.150 $
php 5.2.0 with Apache server 2.2.4.
I can get the pdf generated into a pdf file into server, and pull it out with no problem. However, i would like to get the data from buffer by using "pdf_get_buffer" function. It doesn't seem to work. Can anyone help?? Or is there another to get PDF file like pdfwriter write it directly from a html? Thanks in advanced!
Working code withouth using "pdf_get_buffer":
Code: Select all
<?php $pdf = pdf_new();
pdf_open_file($pdf,"test.pdf");
pdf_begin_page($pdf, 792,1224);
//text
$fonttwo = pdf_findfont($pdf, "Helvetica-Bold", "host", 0);
pdf_setfont($pdf, $fonttwo, 20);
pdf_show_xy($pdf, "Testing code", 30,400 );
pdf_show_xy($pdf, "Output to PDF", 30, 350);
//closeing
pdf_end_page($pdf);
pdf_close($pdf); ?>Code: Select all
<?php $pdf = pdf_new();
pdf_open_file($pdf);
pdf_begin_page($pdf, 792,1224);
//text
$fonttwo = pdf_findfont($pdf, "Helvetica-Bold", "host", 0);
pdf_setfont($pdf, $fonttwo, 20);
pdf_show_xy($pdf, "Testing code", 30,400 );
pdf_show_xy($pdf, "Output to PDF", 30, 350);
//closeing
pdf_end_page($pdf);
pdf_close($pdf);
//get from buffer
$buffer = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-Length: ".strlen($buffer));
header("Content-Disposition: inline; filename=test.pdf");
echo $buffer ;
pdf_delete($pdf); ?>