PHPackages                             org\_heigl/html-to-pdflib - 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. org\_heigl/html-to-pdflib

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

org\_heigl/html-to-pdflib
=========================

Convert HTML for usage in PDFlib

2.0.1(4y ago)3773[1 issues](https://github.com/heiglandreas/htmltopdflib/issues)[1 PRs](https://github.com/heiglandreas/htmltopdflib/pulls)MITPHPPHP ^7.4 || ^8.0

Since Sep 21Pushed 3y ago2 watchersCompare

[ Source](https://github.com/heiglandreas/htmltopdflib)[ Packagist](https://packagist.org/packages/org_heigl/html-to-pdflib)[ RSS](/packages/org-heigl-html-to-pdflib/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

Html to PDFlib
==============

[](#html-to-pdflib)

An extendable library to convert HTML-Content to text usable with textflows of [PDFlib](http://pdflib.com)

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

[](#installation)

Install the package via [composer](https://getcomposer.org) like this:

```
composer require org_heigl/html-to-pdflib
```

Usage
-----

[](#usage)

In your PHP-Code you can use the package like this:

```
$converter = new Converter();
$pdflibtext = $converter->convert($htmlcontent);

// $pdflibtext now contains calls to macros.
// The macros themselves need to be prepend to the text though!!
$pdflibtext = '' . $pdflibtext;
```

Alternatively – to get full flexibility – you can create the Converter with your own ConverterList like this:

```
use Org_Heigl\HtmlToPdflib\Converter;
use Org_Heigl\HtmlToPdflib\ConverterList;
use Org_Heigl\HtmlToPdflib\Converter\Em;
use Org_Heigl\HtmlToPdflib\Converter\Li;
use Org_Heigl\HtmlToPdflib\Converter\Ol;
use Org_Heigl\HtmlToPdflib\Converter\P;
use Org_Heigl\HtmlToPdflib\Converter\Strong;
use Org_Heigl\HtmlToPdflib\Converter\Ul;
use Org_Heigl\HtmlToPdflib\Factory;

$converter = new Converter(Factory::fromConverterList(ConverterList::createViaReflection([
    'em' => Em::class,
    'li' => Li::class,
    'ol' => Ol::class,
    'p' => P::class,
    'strong' => Strong::class,
    'ul' => Ul::class,
])));
```

This allows you to also add your own Converter-implementations as long as they implement the ConvertertInterface.

Currently the following macros are defined:

- bold
- bolditalic
- italic

The following HTML-Tags are currently supported:

- em
- li
- ol
- p
- strong
- ul

Further Tags can be added. Feel free to fork this repository and open a PullRequest for further tags.

Contributing
------------

[](#contributing)

Contributions are welcome!

License
-------

[](#license)

This package is licensed unter the MIT-License.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

4

Last Release

1819d ago

Major Versions

1.1.0 → 2.0.02020-12-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ae5183aaad2bc7453230704bd6991dc6ccbcd6e775c6a29efdc94350a69f247?d=identicon)[heiglandreas](/maintainers/heiglandreas)

---

Top Contributors

[![heiglandreas](https://avatars.githubusercontent.com/u/91998?v=4)](https://github.com/heiglandreas "heiglandreas (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/org-heigl-html-to-pdflib/health.svg)

```
[![Health](https://phpackages.com/badges/org-heigl-html-to-pdflib/health.svg)](https://phpackages.com/packages/org-heigl-html-to-pdflib)
```

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)[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.1k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)

PHPackages © 2026

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