PHPackages                             hanhan/fpdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. hanhan/fpdf

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

hanhan/fpdf
===========

pdf组件，支持中文

1.0.1(1y ago)026MITPHPPHP &gt;=7.2

Since Jan 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/han013/fpdf)[ Packagist](https://packagist.org/packages/hanhan/fpdf)[ RSS](/packages/hanhan-fpdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

FPDF/FPDI组件，支持中文
================

[](#fpdffpdi组件支持中文)

整合网上大佬的代码，使用 `fpdf 1.81` 版本 支持中文！支持中文！支持中文！ 可使用 `fpdi` `TCPDF`

- 安装

```
composer require hanhan/fpdf

```

- 使用

    - 首先[点击链接](http://www.fpdf.org/makefont/)去生成对应的字体文件，放到自定义目录中，下面要用
    - 下面直接上代码

    ```
    use hanhan\fpdi\Fpdi;

    define('FPDF_FONTPATH', '/font/'); # 字体路径，这里主要是针对中文字体
    $pdf = new Fpdi();
    $pdf->AddGBFont('simhei', '黑体');
    $pdf->AddPage();
    $pdf->SetFont('simhei', '', 16);
    $pdf->Cell(80, 20, iconv("utf-8", "gbk", "测试中文")); # 注意这里的转码

    $pdf->Output('example.pdf', 'F');
    ```

​ 注意 `FPDF_FONTPATH`定义一定要在 `$pdf = new Fpdi()` 之前！

- 文档

    - [fpdf官网](http://www.fpdf.org/)
    - [字体生成](http://www.fpdf.org/makefont/)
- 使用有问题邮件我

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Total

2

Last Release

445d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ed9842d3469be8239be395f13b57057f22cb016f7d2ffaa8f95d8296d8b4845?d=identicon)[han013](/maintainers/han013)

---

Top Contributors

[![han013](https://avatars.githubusercontent.com/u/44900212?v=4)](https://github.com/han013 "han013 (5 commits)")

---

Tags

pdffpdifpdf

### Embed Badge

![Health badge](/badges/hanhan-fpdf/health.svg)

```
[![Health](https://phpackages.com/badges/hanhan-fpdf/health.svg)](https://phpackages.com/packages/hanhan-fpdf)
```

###  Alternatives

[setasign/fpdi

FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.

1.2k142.4M231](/packages/setasign-fpdi)[setasign/fpdf

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

76863.8M227](/packages/setasign-fpdf)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[setasign/fpdi-protection

A FPDI compatible version of the FPDF\_Protection script.

324.3M2](/packages/setasign-fpdi-protection)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[tmw/fpdm

PDF form filling using FPDM Class written by FPDF author Olivier

129623.6k3](/packages/tmw-fpdm)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
