博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php生成PDF文件(FPDF)
阅读量:4056 次
发布时间:2019-05-25

本文共 2137 字,大约阅读时间需要 7 分钟。

首先要下载FPDF http://www.fpdf.org/  附件可以在我的资源里下载 http://download.csdn.net/detail/shaobingj126/9182831

例子:将下面的文件保存在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();
?>

转载地址:http://qqoci.baihongyu.com/

你可能感兴趣的文章
能源化工要怎么管控核心数据
查看>>
媒体广告业如何运用云盘提升效率
查看>>
企业如何运用企业云盘进行数字化转型-实现新发展
查看>>
司法如何运用电子智能化加快现代化建设
查看>>
iSecret&nbsp;1.1&nbsp;正在审核中
查看>>
IOS开发的开源库
查看>>
IOS开发的开源库
查看>>
Jenkins - sonarqube 代码审查
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成(一)
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成 - 单机部署(二)
查看>>
Jenkins + Docker + SpringCloud 微服务持续集成 - 高可用集群部署(三)
查看>>
Golang struct 指针引用用法(声明入门篇)
查看>>
Linux 粘滞位 suid sgid
查看>>
C#控件集DotNetBar安装及破解
查看>>
Winform皮肤控件IrisSkin4.dll使用
查看>>
Winform多线程
查看>>
C# 托管与非托管
查看>>
Node.js中的事件驱动编程详解
查看>>
mongodb 命令
查看>>
MongoDB基本使用
查看>>