0

我想为我的 PHP 网页创建 PDF 文件,它必须是一些按钮,例如创建 PDF,然后用户单击按钮 PDF 文件必须自动生成我的网页动态页面,它包含 MySQL 表我是如何做到的,并且有任何开源软件适用于它...

4

2 回答 2

1

您可以使用 fpdf 制作 PDF:http: //fpdf.org/

<?php
require('fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
于 2012-12-15T11:18:26.297 回答
0

像往常一样生成 PHP,但添加header

header("Content-Type: application/pdf");
header('Content-Disposition:inline; filename="testing.pdf"'); //view in browser

或者

 header("Content-Type: application/pdf");
 header('Content-Disposition:attachment; filename="testing.pdf"'); //force download
于 2012-12-15T11:16:42.343 回答