Reputation: 746
I have success to test my code with function Zend_Pdf()
for easy to understand, this is my code :
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
// set font for page
// write text to page
$test = "This is reporting for <br /> hello world: LALALA......";
$page->setFont($font, 15)
->drawText('That which we call a rose,', 72,720)
->drawText("$test", 72, 620);
// add page to document
$pdf->pages[] = $page;
$pdf->save("data/reports/" . $_SESSION['User_fonction'] ."-report.pdf");
My cods will show in pdf file
That which we call a rose
and This is reporting for <br /> hello world: LALALA......
My question
how i can resolve this problem by i can write tag html in it by well like tag <br />
is should know ?
any one used to understand on it please. Any help ...
I am looking forword to see your reply soon. thanks .
Upvotes: 2
Views: 3812
Reputation: 13558
What you want to achieve is you have html (so text with markup) and that must be converted into a PDF file. This is unfortunately not the goal of Zend_Pdf. The pdf component allows only to set plain text and not any markup attached.
You can use a Zend Framework 2 module (you tagged your question with zend-framework-2, I assume you use it then) called DomPdfModule. You use Zend Framework 2 view scripts to render the result and use above module to convert it into a PDF file.
Upvotes: 2
Reputation: 12809
Zend_PDF won't handle HTML, you should try something such as:
http://www.tcpdf.org/
http://code.google.com/p/wkhtmltopdf/
Upvotes: 1