php实现生成PDF文件的方法示例【基于FPDF类库】
程序员文章站
2022-04-14 09:37:12
本文实例讲述了php实现生成pdf文件的方法。分享给大家供大家参考,具体如下:
首先要下载fpdf
或者点击此处。
例子:将下面的文件保存在web根目录,与附件fp...
本文实例讲述了php实现生成pdf文件的方法。分享给大家供大家参考,具体如下:
首先要下载fpdf
或者点击此处。
例子:将下面的文件保存在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文件操作总结》、《php操作office文档技巧总结(包括word,excel,access,ppt)》、《php数组(array)操作技巧大全》、《php数据结构与算法教程》、《php程序设计算法总结》、《php数学运算技巧总结》及《php字符串(string)用法总结》
希望本文所述对大家php程序设计有所帮助。
下一篇: 无线路由器自动掉线如何解决
推荐阅读
-
PHP实现HTML生成PDF文件的方法
-
PHP实现的无限分类类库定义与用法示例【基于thinkPHP】
-
PHP基于phpqrcode类生成二维码的方法示例详解
-
AngularJS基于http请求实现下载php生成的excel文件功能示例
-
php实现生成PDF文件的方法示例【基于FPDF类库】
-
PHP简单实现生成txt文件到指定目录的方法 php调用父类的方法 php调用类的方法 php函数和方法的区
-
PHP实现的无限分类类库定义与用法示例【基于thinkPHP】
-
PHP实现HTML生成PDF文件的方法
-
PHP实现HTML生成PDF文件的方法,
-
PHP基于phpqrcode类生成二维码的方法示例详解