问题
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: FPDFThis 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