从php生成PDF报告 [英] Generate PDF report from php
本文介绍了从php生成PDF报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用php代码查询数据库,结果将用于生成报告.
I am using php code to query to a database and the results will be used to generate a report.
如果我希望以pdf格式生成报告,该怎么办?
If I want the report to be generated in a pdf format how should I do it ?
推荐答案
如果您的PDF文件需要UTF支持,请考虑使用tcpdf
库.
If you need UTF support in your PDF file, consider tcpdf
library.
从此处下载: http://www.tecnick.com /public/code/cp_dpage.php?aiocp_dp=tcpdf
在您的脚本中:
<?php
//include files
require_once($_SERVER['DOCUMENT_ROOT'].'/tcpdf/config/lang/eng.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/tcpdf/tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
//add some content using class methods
//Close and output PDF document
$pdf->Output('filename.pdf', 'I');
?>
这篇关于从php生成PDF报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文