PHPackages                             armin/md2pdf - 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. armin/md2pdf

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

armin/md2pdf
============

Converts multiple markdown files to HTML and PDF.

0.2.1(2y ago)65.6k1[1 issues](https://github.com/a-r-m-i-n/md2pdf/issues)MITPHPPHP ^8.1

Since Apr 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/a-r-m-i-n/md2pdf)[ Packagist](https://packagist.org/packages/armin/md2pdf)[ Docs](https://github.com/a-r-m-i-n/md2pdf)[ RSS](/packages/armin-md2pdf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (13)Versions (6)Used By (0)

armin/md2pdf
============

[](#arminmd2pdf)

PHP application to convert multiple markdown files to HTML and PDF.

It's a more simple alternative to e.g. [pandoc](https://pandoc.org/).

**This is a very early prototype!** Without any release, yet.

Documentation
-------------

[](#documentation)

Checkout the [full Documentation](docs/index.md) in this repository or checkout the rendered PDF version (TODO).

First steps
-----------

[](#first-steps)

Download the latest phar binary or add this package (`armin/md2pdf`) to your composer.json.

When using Composer to require the package, you can access the binary on CLI using:

```
vendor/bin/md2pdf

```

Now, you need to create `md2pdf.yaml` file in your project's root directory.

**Minimum example:**

```
title: Test Document
author: Armin Vieweg
baseUrl: https://github.com/a-r-m-i-n/md2pdf/blob/master
rootPath: .
structure:
  - section: Documentation
    level: 1
  - docs/index.md
  - docs/configuration.md
  - section: README Contents
    level: 1
  - README.md

output: md2pdf-documentation.pdf
```

In this file, we define the structure of the HTML/PDF output. We can also separate contents, using sections.

Now, you can simply run:

```
vendor/bin/md2pdf build

```

Early version
-------------

[](#early-version)

As already mentioned before, this is a very early prototype. The code needs heavy refactoring, some functionality is not working properly or still missing entirely.

It is planned to implement four modes you can choose from:

- init - to kickstart initial md2pdf.yaml file
- check - for new and missing files in structure
- update - update md2pdf.yaml structure (apply results from check)
- build - create the actual output

Currently, the build mode is the only implemented one.

Features
--------

[](#features)

- Merge configured markdown structure (files) and convert to HTML (using [league/commonmark](https://commonmark.thephpleague.com/2.0/extensions/overview/))
- Provide extended anchors (including sanitized filename)
- Replace relative links to documentation by extended anchors (*does not work properly, yet*)
- Prepend configured baseUrl to relative links to files in repository (which are not part of the configured markdwn structure)
- Provide table of content for every headline (with page numbers, good for printing)
- Provide bookmarks for every headline (good for PDF readers)
- Add custom sections to structure to separate contents
    - Level customizable (starts with 1)
    - You can also pass additional formatted texts, using the `contents` sub-key, which accepts markdown formatted input
- Syntax highlighting for embedded code (configurable, using [scrivo/highlight.php](https://github.com/scrivo/highlight.php))
- Configurable styles
- Manual page-breaks and orientation changes possible (`  `)
- Output converted markdown contents (via HTML) to PDF (using [mpdf/mpdf](https://mpdf.github.io/))
- Phar compiler
    - because of filesize reasons, only the TTF fonts "DejaVuSerif" and "DejaVuSans" are included to phar binary

### Missing

[](#missing)

- Modes: init, check and update
- Refactored analyzing of relative links in markdown content
- PDF setup
    - sizes, borders, etc
    - path to custom fonts
- ability to also save the HTML file
- configuration to disable bookmarks
- cleanup (remove tmp dir)
- complete documentation

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

Total

4

Last Release

1091d ago

PHP version history (2 changes)0.1.0PHP ^7.4 | ^8.0

0.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/355aa463a532a530009c06219f83ab8b20a9b80a2bc8995064b6d390c6427735?d=identicon)[ArminVieweg](/maintainers/ArminVieweg)

---

Top Contributors

[![a-r-m-i-n](https://avatars.githubusercontent.com/u/1275298?v=4)](https://github.com/a-r-m-i-n "a-r-m-i-n (19 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)

PHPackages © 2026

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