Forums / Developer / PDF Export / Comment50555
Jérôme Vieilledent
Saturday 07 February 2009 6:38:59 am
Bonjour Franck :-)
The main idea is to develop something in PHP using TCPDF or any other PHP PDF library (Zend_PDF, FPDF...). You could that by developping a module or just a simple template operator.TCPDF supports xHTML, so it can be possible to build the PDF from within a template with a raw layout outputed with <i>application/pdf</i> mimetype (see layout.ini for that). Let's say that you have developped an operator named <i>pdf_output</i> which builds your PDF in PHP from xHTML content (see TCPDF examples at http://tcpdf.org). In your template, you can bufferize your generated HTML content with the <i>{set-block}</i> function. So all you have to do is :
{set-block variable=$myContent} {* Add you content here, with all your fetches, includes, etc... *} {/set-block} {pdf_output($myContent)}
Of course, your operator is supposed to return the PDF stream generated by TCPDF.