PHPackages                             papier/papier - 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. papier/papier

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

papier/papier
=============

Low-level PHP library for generating PDF files

v1.4.2(10mo ago)2211[1 issues](https://github.com/mikaelcarlavan/papier/issues)MITPHPPHP &gt;=8.0

Since Dec 28Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/mikaelcarlavan/papier)[ Packagist](https://packagist.org/packages/papier/papier)[ Docs](https://papier.io)[ Fund](https://www.buymeacoffee.com/mikaelcarlavan)[ RSS](/packages/papier-papier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

Papier
======

[](#papier)

 [![Total Downloads](https://camo.githubusercontent.com/9b57d6ff0ada30322513207cb07a8626a4ea27caf55a29e59e10cb3f103a06e2/68747470733a2f2f706f7365722e707567782e6f72672f7061706965722f7061706965722f642f746f74616c2e737667)](https://packagist.org/packages/papier/papier) [![Latest Stable Version](https://camo.githubusercontent.com/23428a9d0894dea89a4daabba41fe550aa1da937aeb29739f6cae710afc6f6db/68747470733a2f2f706f7365722e707567782e6f72672f7061706965722f7061706965722f762f737461626c652e737667)](https://packagist.org/packages/papier/papier) [![License](https://camo.githubusercontent.com/b517e24c868b16acbdd6b697f509db1634674deae7039b67463712298cd65109/68747470733a2f2f706f7365722e707567782e6f72672f7061706965722f7061706965722f6c6963656e73652e737667)](https://packagist.org/packages/papier/papier)

Introduction
------------

[](#introduction)

Papier is a low-level PHP library for generating PDF files. It implements the ISO 32000-1 standard.

Why not use FPDF or TCPDF?
--------------------------

[](#why-not-use-fpdf-or-tcpdf)

Although these are excellent libraries, they don't allow you to use the many features offered by the PDF format.

What can be done with Papier ?
------------------------------

[](#what-can-be-done-with-papier-)

The library is growing every day; for the moment Papier can be used to write texts, draw shapes and display images and graphics. Papier supports the following:

- JPEG and PNG with transparency images.
- RGB and CMYK colors spaces for texts.
- Texts and images can be transformed (rotation, translation, skew).
- True type fonts are supported.

Installation
------------

[](#installation)

You can install Papier via composer using:

```
composer require papier/papier
```

Example usage
-------------

[](#example-usage)

```
use Papier\Papier;
use Papier\Factory\Factory;
use Papier\Graphics\DeviceColourSpace;
use Papier\Text\Encoding;
use Papier\Text\RenderingMode;

require __DIR__.'/vendor/autoload.php';

$pathToLocalFontFile = 'Lato-Regular.ttf';
$pathToLocalImage = 'test.png';

$pdf = new Papier();
$pdf->getHeader()->setVersion(7);

$page = $pdf->addPage([210, 297]);
$image = $pdf->addImageComponent()->setPage($page);
$image->setSource($pathToLocalImage);
$image->setWidth(50);
$image->translate(10, 10);

$font = Factory::create('Papier\Type\TrueTypeFontDictionaryType', null, true);
$font->load($pathToLocalFontFile);
$font->setEncoding(Encoding::WIN_ANSI);

$page = $pdf->addPage([210, 297]);

$text = $pdf->addTextComponent();
$text->setNonStrokingColor(1, 0, 0);
$text->setStrokingColor(0, 1, 0);
$text->setNonStrokingColorSpace(DeviceColourSpace::RGB);
$text->setStrokingColorSpace(DeviceColourSpace::RGB);
$text->setRenderingMode(RenderingMode::FILL_THEN_STROKE);
$text->setText('Café');
$text->setFont($font);
$text->setFontSize(12);
$text->translate(100, 100);
$text->setWidth(100);
$text->setTextAlign(\Papier\Text\TextAlign::CENTER);

$boundingBox = $text->getBoundingBox();

$rect = $pdf->addRectangleComponent()->setPage($page);
$rect->setStrokingColor(0.9, 0, 0);
$rect->setStrokingColorSpace(DeviceColourSpace::RGB);
$rect->setXY($boundingBox[0], $boundingBox[1]);
$rect->setWidth($boundingBox[2]);
$rect->setHeight($boundingBox[3]);

$annot = $pdf->addTextAnnotation($page);
$annot->setContents('Hello World !');
$annot->setRect([50, 50, 70, 100]);
$annot->setT('Mikael');
$annot->setOpen(true);

$page = $pdf->addPage([210, 297]);

$draw = $pdf->addDrawComponent()->setPage($page);
$draw->setNonStrokingColor(0.4, 0, 0.4);
$draw->setStrokingColor(0.9, 0, 0);
$draw->setStrokingColorSpace(DeviceColourSpace::RGB);
$draw->setNonStrokingColorSpace(DeviceColourSpace::RGB);
$draw->addPoint(50, 50);
$draw->addPointWithControlPoints(150, 5, 74, 120, 150, 150);
$draw->addPoint(200, 200);

$pageLabels = $pdf->getPageLabels();
$pageLabels->addLabel(0, \Papier\Document\NumberingStyle::LOWERCASE_ROMAN);

$info = $pdf->getInfo();
$info->setTitle('Papier');
$info->setAuthor('Mikaël Carlavan');

$viewer = $pdf->getViewerPreferences();
$viewer->setDisplayDocTitle(true);

$pdf->save('test.pdf');
```

More examples can be found in the **examples** directory.

License
-------

[](#license)

Papier is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance59

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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 ~28 days

Recently: every ~48 days

Total

8

Last Release

309d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c5b16e3b7d6b3395803839de2634643c84ced051fe109c470060a381efdc34e?d=identicon)[mikaelcarlavan](/maintainers/mikaelcarlavan)

---

Top Contributors

[![mikaelcarlavan](https://avatars.githubusercontent.com/u/10746841?v=4)](https://github.com/mikaelcarlavan "mikaelcarlavan (565 commits)")

---

Tags

pdfpdf-generationphpphp-library

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)[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)[aspera/xlsx-reader

Spreadsheet reader library for XLSX files

52742.2k5](/packages/aspera-xlsx-reader)

PHPackages © 2026

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