【发布时间】:2011-07-18 06:10:36
【问题描述】:
我是 FPDF 新手。
但我正在尝试如下。如何使用 FPDF 从 HTML 标签创建 PDF?
<?php
require('fpdf.php');
include (connection.php)
$result = mysql_query("SELECT * FROM emp");
<!--- I don't know how to add the html tag here -->
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Output();
?>
下面是我的 PHP 程序
<?php
include (connection.php)
$result = mysql_query("SELECT * FROM emp");
?>
<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td> <?php print $row['FirstName']; ?></td>
<td> <?php print $row['LastName']; ?></td>
</tr>
<?php
}
?>
</table>
<?php
mysql_close($con);
?>
【问题讨论】:
-
既然您对 HTML 很熟悉,您可能需要考虑使用 List of HTML to PDF converters。它不仅涵盖了基于 PHP 的解决方案,还列出了各种选项。