FPDF Text with HTML tags

孤人 提交于 2019-12-25 04:56:28

问题


I'm using FPDF to create an A4 sized PDF, I can add text/images and this is working fine. I have a dynamically generated string which contains some HTML tags (BR etc) and was wondering how I can have that output onto the PDF as opposed to literally printing the tags out.

$centre = urldecode($row_CertDetails['centre_name']);

$pdf->Text(10, 110, $centre);

I've seen on some forums people mentioning WriteHTML, however my version of FPDF doesn't seem to include that.

Is it an add-on?


回答1:


Yes, it is an Add-On:

Write HTML

Author: Clément Lavoillotte
License: FPDF

This is an enhancement of the WriteHTML() method from tutorial 6. Supported tags are: ...

Please see Write HTML FPDF Script #42 which I think is the latest version, but feel free to browse the FPDF scripts/Add-Ons.




回答2:


I've solved it anyway.

Because I'm also using FPDI, what I did was extract the contents of the class in http://www.fpdf.org/en/script/script42.php and put it inside the FPDI.php file.



来源:https://stackoverflow.com/questions/15272050/fpdf-text-with-html-tags

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!