PHPackages                             famoser/pdf-generator - 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. famoser/pdf-generator

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

famoser/pdf-generator
=====================

a clean pdf generator without dependencies

v0.7(1y ago)181.5k↑33.3%2[1 issues](https://github.com/famoser/pdf-generator/issues)MITPHPPHP &gt;=8.2CI passing

Since Jan 28Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/famoser/pdf-generator)[ Packagist](https://packagist.org/packages/famoser/pdf-generator)[ RSS](/packages/famoser-pdf-generator/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (8)Dependencies (6)Versions (12)Used By (0)

pdf-generator
=============

[](#pdf-generator)

[![MIT licensed](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](./LICENSE)[![PHP Composer](https://github.com/famoser/pdf-generator/actions/workflows/php.yml/badge.svg)](https://github.com/famoser/pdf-generator/actions/workflows/php.yml)

About
-----

[](#about)

Generates pdf files without any dependencies. Includes a layout engine to handle flow content (e.g. text spanning over more than one page).

```
composer require famoser/pdf-generator
```

This is still under active development ([contributions welcome!](./CONTRIBUTE.md)), and the public API is subject to change. If you are looking for a more mature project, see .

Getting started
---------------

[](#getting-started)

Using the printer:

```
// places "Hello world" in the top-left corner of the document.
$document = new Document();
$printer = $document->createPrinter();

$bodyText = new TextStyle(Font::createFromDefault());
$printer->printText('Hello world', $bodyText);

file_put_contents('example.pdf', $document->save());
```

The printer is useful when the exact position of elements is known. For example, for correspondence with fixed layout (e.g. the address in a letter) or for documents with page numbers. However, for many elements (such as tables) determining the exact position is cumbersome. For this, layouts are provided.

Using layouts:

```
// adds a rectangle, followed by "Hello moon".
// placement is decided by Flow, which places elements one-after-the-other.
$flow = new Flow();

$rectangle = new Rectangle(width: 120, height: 80, style: new DrawingStyle());
$flow->addContent($rectangle);

$text = new Text();
$text->addSpan('Hello moon', $bodyText);
$flow->add($text);

$document->add($flow);

file_put_contents('example.pdf', $document->save());
```

The layouts allow to declare *what* needs to be printed, and then takes care of the *where*. Provided are flows, grids, tables and text.

Examples
--------

[](#examples)

### Invoice

[](#invoice)

[Code](./examples/invoice.php) | [.pdf](./examples/invoice.pdf)

   [![Invoice](examples/invoice.png?raw=true)](examples/invoice.png?raw=true)  ### Book

[](#book)

[Code](./examples/book.php) | [.pdf](./examples/book.pdf)

   [![Book page 1](examples/book_1.png?raw=true)](examples/book_1.png?raw=true) [![Book page 2](examples/book_2.png?raw=true)](examples/book_2.png?raw=true)   [![Book page 3](examples/book_3.png?raw=true)](examples/book_3.png?raw=true) [![Book page 4](examples/book_4.png?raw=true)](examples/book_4.png?raw=true)

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance68

Regular maintenance activity

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 99.7% 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 ~309 days

Recently: every ~318 days

Total

8

Last Release

543d ago

PHP version history (3 changes)v0.1PHP ^7.1

v0.3PHP &gt;=7.4

v0.5PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5077020?v=4)[Florian Moser](/maintainers/famoser)[@famoser](https://github.com/famoser)

---

Top Contributors

[![famoser](https://avatars.githubusercontent.com/u/5077020?v=4)](https://github.com/famoser "famoser (620 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

packagistpdf-generationphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/famoser-pdf-generator/health.svg)

```
[![Health](https://phpackages.com/badges/famoser-pdf-generator/health.svg)](https://phpackages.com/packages/famoser-pdf-generator)
```

###  Alternatives

[42coders/document-templates

Document template management package.

19940.0k](/packages/42coders-document-templates)[qipsius/tcpdf-bundle

A bundle to easily integrate TCPDF into Symfony

23749.5k](/packages/qipsius-tcpdf-bundle)[macopedia/magmi2

Magento Mass Importer 'Magmi' for Magento 2

11615.7k](/packages/macopedia-magmi2)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1719.4k](/packages/tarfin-labs-easy-pdf)[akeneo-labs/excel-connector-bundle

Akeneo PIM Excel connector bundle

166.4k](/packages/akeneo-labs-excel-connector-bundle)

PHPackages © 2026

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