定制 cbaudry/fpdf-utf8 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cbaudry/fpdf-utf8

Composer 安装命令:

composer require cbaudry/fpdf-utf8

包简介

tfpdf

README 文档

README

This is an unofficial repository for the FPDF-library.
The purpose is to be able to build automatic packages using composer.

Install

You can install this library by editing (or creating) your composer.json:

{
	"require": {
		"cbaudry/fpdf-utf8": "*"
	}
}

And run composer update or composer install.

Or you can simply run the composer command, composer require cbaudry/fpdf-utf8.

Usage

Namespacing

The namespacing has been changed to CS\FPDF.

Caching

In this version you can set the cache folder yourself, so it will not put the cache files into the same directory as the font-files. Please note that if you do not set the cache folder, no caching is used and documents may be created a little bit slower.

use CS\FPDF\PDF;

$fpdf = new PDF();
$fpdf->setFontPath('/font/unifont/');
$fpdf->setCache('/cache/');
$fpdf->AddPage();
$fpdf->AddFont('OpenSans');
$fpdf->SetFont('OpenSans');
$fpdf->Write('This is a test PDF with OpenSans as font');
$fpdf->Output(); 

Exception

A custom exception class FPDFException has been created. For all exception error codes, please take a look at the src/FPDF/Exception/FPDFException.php file.

About

What is FPDF-UTF8?

FPDF-UTF8 is a version of FPDF, which supports UTF-8 and font-subsetting.
This is a updated version (fork) of FaimMedia's version, which is an updated version (fork) of tFPDF.

What is FPDF?

FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

FPDF has other advantages: high level functions. Here is a list of its main features:

  • Choice of measure unit, page format and margins
  • Page header and footer management
  • Automatic page break
  • Automatic line break and text justification
  • Image support (JPEG, PNG, GIF and WebP)
  • Colors
  • Links
  • TrueType, Type1 and encoding support
  • Page compression
  • EAN 13, 128 and Code 39 support (without extending the main class)
  • PDF Encryption (without extending the main class)
  • File Attachment
  • Add XMP data

FPDF requires no extension, except zlib (to activate compression and handle png alpha chanel) and GD (for GIF support). It works and will be maintained with PHP 8 and above.

The tutorials will give you a quick start. The complete online documentation is here and download area is there. It is strongly advised to read the FAQ which lists the most common questions and issues.

A script section is available and provides some useful extensions (such as bookmarks, rotations, tables, barcodes...).

What languages can I use?

The class can produce documents in many languages other than the Western European ones: Central European, Cyrillic, Greek, Baltic and Thai, provided you own TrueType or Type1 fonts with the desired character set. Chinese, Japanese and Korean are supported too. UTF-8 support is also available.

What about performance?

Of course, the generation speed of the document is less than with PDFlib. However, the performance penalty keeps very reasonable and suits in most cases, unless your documents are particularly complex or heavy.

Source attribution

The Code 128 and Code 39 barcode library code was taken directly from the FPDF website, where source attribution is vague at best, but mostly non-existent. If you need source attribution applying for your code included here, please raise an issue.

Based on FPDF's Website :

  • EAN 128 has been shared by Roland Gautier (dir@persolaser.com)
  • EAN 13 has been shared by Olivier (oliver@fpdf.org)
  • Code 39 has been shared by Emmanuel Havet (ehavet@yahoo.fr)
  • The base of this library has been release by Ian Back (ian@bpm1.com) under the LGPL licence
  • File Attachment has been shared by Olivier (oliver@fpdf.org) and modified to be directly integrated within FPDF

cbaudry/fpdf-utf8 适用场景与选型建议

cbaudry/fpdf-utf8 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pdf」 「utf-8」 「fpdf」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cbaudry/fpdf-utf8 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cbaudry/fpdf-utf8 我们能提供哪些服务?
定制开发 / 二次开发

基于 cbaudry/fpdf-utf8 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 31
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 41
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2025-04-24