itbz/fpdf
最新稳定版本:1.7.3
Composer 安装命令:
composer require itbz/fpdf
包简介
Unofficial PSR-0 compliant version of the FPDF library
README 文档
README
NOTE that this package is discontinued and will not be updated. Please see https://github.com/Setasign/FPDF instead.
FPDF
Unofficial PSR-0 compliant version of the FPDF library
This is version 1.7 with some minor changes:
-
the library is namespaced in fpdf. To create instance use
$fpdf = new \fpdf\FPDF();
-
directory structure follow the PSR-0 standard with src/ as root
-
on error a RuntimeException is thrown instead on lib dramatically dying
-
constructor is renamed
__constructinstead ofFPDF
Installing with composer
The package exists in the packagist repository as itbz/fpdf.
FPDF_EXTENDED
This package also contains some extensions that break backwards compatibility.
To access the enhanced functionality use FPDF_EXTENDED instead of FPDF.
-
FPDF_EXTENDED expects all input to be UTF-8 encoded. FPDF natively expects all input to be ISO-8859-1 encoded and recommends the use of utf8_decode() when working with utf-8 encoded strings.
-
FPDF uses a somewath strange syntax for printing the total number of pages in the pdf. FPDF_EXTENDED defines two methods to handle this.
TotalPagesNo()returns a string that will be replaced with total number of pages at output.PaginationStr()takes an optional delimiter (default '/') and retuns '{current page} / {total number of pages}'. -
Calling
AliasNbPages()is no longer necessary. -
You may set an image path using
setImagePath()andimage()will be able to understand relative paths. -
FPDF_EXTENDED gracefuly handles missing font styles. If a font is only defined (added) for one style (eg. bold) and you try to use another (eg. italic) this FPDF_EXTENDED fallbacks to the defined style (eg. bold). Regular styles takes precedence.
-
FPDF_EXTENDED defines
moveX()andmoveY()to move the cursor, in addition to FPDFssetX()andsetY(). -
Subclasses of FPDF_EXTENDED may define
draw(). Draw is called just before pdf is rendered. In this may actions can be taken just before pdf creation. -
FPDF_EXTENDED defines
GetPdf()as a shorthand for outputing the pdf as a raw string. -
AS of version 1.7.2 FPDF_EXTENDED defines WriteXY() for writing to a specified position.
itbz/fpdf 适用场景与选型建议
itbz/fpdf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.51M 次下载、GitHub Stars 达 78, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 itbz/fpdf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 itbz/fpdf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.51M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 86
- 点击次数: 30
- 依赖项目数: 34
- 推荐数: 0
其他信息
- 授权协议: no
- 更新时间: 2026-01-04