php实现生成PDF文件的方法示例【基于FPDF类库】
网络编程 2021-07-05 08:24www.168986.cn编程入门
这篇文章主要介绍了php实现生成PDF文件的方法,结合实例形式分析了php基于FPDF类库实现生成pdf文件的相关操作技巧,需要的朋友可以参考下
本文实例讲述了php实现生成PDF文件的方法。分享给大家供大家参考,具体如下
要下载FPDF
或者点击此处。
例子将狼蚁网站SEO优化的文件保存在web根目录,与附件fpdf17处于同一级
<?php ini_set('display_errors', '0'); ini_set('max_execution_time', '60'); require ('fpdf17/chinese.php'); $pdf = new PDF_Chinese(); $pdf->AddGBFont(); $pdf->Open(); $pdf->AddPage(); $pdf->SetFont('GB', 'B', 10); $pdf->SetLeftMargin(15.0); $pdf->Cell(180, 8, iconv("UTF-8", "gbk", "2015年10月出勤统计表 导出时间: 2015-10-14 市场部3人"), 1, 0, 'C'); $pdf->Ln(); //以上是表头 $pdf->SetFont('GB', '', 8); $pdf->SetLeftMargin(15.0); $pdf->Cell(10, 8, iconv("UTF-8", "gbk", "UID"), 1, 0, 'C'); $pdf->Cell(10, 8, iconv("UTF-8", "gbk", "姓名"), 1, 0, 'C'); $pdf->Cell(10, 8, iconv("UTF-8", "gbk", "部门"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "出勤/天"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "出勤/小时"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "迟到/次"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "迟到/分钟"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "早退/次"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "早退/次"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "早退/分钟"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "缺卡/次"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "地点异常/次"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "账号状态"), 1, 0, 'C'); $pdf->Ln(); $pdf->Cell(10, 8, iconv("UTF-8", "gbk", "10002"), 1, 0, 'C'); $pdf->Cell(10, 8, iconv("UTF-8", "gbk", "市场部"), 1, 0, 'C'); $pdf->Cell(10, 8, iconv("UTF-8", "gbk", "1"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "9.0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Cell(15, 8, iconv("UTF-8", "gbk", "0"), 1, 0, 'C'); $pdf->Ln(); $pdf->Output(); ?>
更多关于PHP相关内容感兴趣的读者可查看本站专题《》、《》、《》、《》、《》、《》及《》
希望本文所述对大家PHP程序设计有所帮助。
编程语言
- 如何快速学会编程 如何快速学会ug编程
- 免费学编程的app 推荐12个免费学编程的好网站
- 电脑怎么编程:电脑怎么编程网咯游戏菜单图标
- 如何写代码新手教学 如何写代码新手教学手机
- 基础编程入门教程视频 基础编程入门教程视频华
- 编程演示:编程演示浦丰投针过程
- 乐高编程加盟 乐高积木编程加盟
- 跟我学plc编程 plc编程自学入门视频教程
- ug编程成航林总 ug编程实战视频
- 孩子学编程的好处和坏处
- 初学者学编程该从哪里开始 新手学编程从哪里入
- 慢走丝编程 慢走丝编程难学吗
- 国内十强少儿编程机构 中国少儿编程机构十强有
- 成人计算机速成培训班 成人计算机速成培训班办
- 孩子学编程网上课程哪家好 儿童学编程比较好的
- 代码编程教学入门软件 代码编程教程