PHPackages                             fissible/transmark-pdf - 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. fissible/transmark-pdf

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

fissible/transmark-pdf
======================

PDF export for fissible/transmark: PdfWriter composes HtmlWriter output with dompdf/dompdf.

v0.1.0(yesterday)00MITPHPPHP ^8.2CI passing

Since Aug 8Pushed todayCompare

[ Source](https://github.com/fissible/transmark-pdf)[ Packagist](https://packagist.org/packages/fissible/transmark-pdf)[ Docs](https://github.com/fissible/transmark-pdf)[ RSS](/packages/fissible-transmark-pdf/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

fissible/transmark-pdf
======================

[](#fissibletransmark-pdf)

PDF export for [fissible/transmark](https://github.com/fissible/transmark): `PdfWriter` composes `HtmlWriter` output with [dompdf/dompdf](https://github.com/dompdf/dompdf) (pure-PHP, LGPL-2.1) to produce PDF bytes — no system binaries, no `ext-gd`.

Why a separate package?
-----------------------

[](#why-a-separate-package)

`fissible/transmark` stays dependency-free at its core. A consumer who only needs DOCX → HTML never pays for a PDF rendering engine. A consumer who wants DOCX → HTML → PDF requires **this one package** — `fissible/transmark` and `dompdf/dompdf` both come along transitively via Composer, so there's one `composer require`, not two separate integrations to wire up by hand.

Requirements
------------

[](#requirements)

- PHP ^8.2
- ext-dom, ext-mbstring, ext-zip

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

[](#installation)

```
composer require fissible/transmark-pdf
```

Usage
-----

[](#usage)

```
use Fissible\Transmark\Pdf\PdfWriter;
use Fissible\Transmark\Readers\DocxReader;
use Fissible\Transmark\Pdf\PdfReader;

$docxBytes = file_get_contents('agreement.docx');
$document = (new DocxReader())->read($docxBytes);

$pdfBytes = (new PdfWriter())->write($document);
$recovered = (new PdfReader())->read($pdfBytes);

file_put_contents('agreement.pdf', $pdfBytes);
```

Pass custom dompdf options when needed:

```
use Dompdf\Options;

$options = new Options();
$options->set('defaultFont', 'Helvetica');

$pdfBytes = (new PdfWriter(options: $options))->write($document);
```

`PdfWriter` implements `Fissible\Transmark\Contracts\WriterInterface`, the same contract `HtmlWriter`, `DocxWriter`, and `MarkdownWriter` implement — it's a drop-in alongside any other `transmark` writer.

### PDF → Document reader

[](#pdf--document-reader)

`PdfReader` is a best-effort PDF reader that recovers a canonical `Document` from PDF bytes using layout heuristics. It throws `Fissible\Transmark\Pdf\Exception\PdfParseException` when the content isn't readable at all — no extractable text (e.g. a scanned/image-only PDF), or content the underlying parser rejects as corrupt — rather than silently returning an empty or partial `Document`.

Limitations to treat as accepted by design:

- Headings and paragraph boundaries are inferred from font-size and spacing, not guaranteed from semantic document structure.
- Inline emphasis/bold and table reconstruction are not recovered.
- Consecutive unordered-list items merge into a single run-on paragraph rather than staying separate list items — dompdf (and most PDF generators) render bullet markers as vector shapes, not text, so there is no signal distinguishing a new bullet item from a wrapped continuation line of the same paragraph. Ordered (numbered) lists are recovered correctly, since numeric markers do render as real text.
- Legal-outline `NumberingRef` structures do not round-trip through PDF text extraction.
- Multi-column layouts are not supported — text is read in per-page top-to-bottom, then left-to-right order, which interleaves columns incorrectly.
- Non-Latin/non-Latin-1 text (e.g. CJK) does not survive a `PdfWriter` → `PdfReader` round trip today — this is a `dompdf`/`PdfWriter` default-font limitation (no CJK glyphs embedded), not a `PdfReader` defect; text that never rendered correctly in the PDF can't be read back correctly either.

### Paper size and orientation

[](#paper-size-and-orientation)

```
$writer = new PdfWriter(paperSize: 'A4', paperOrientation: 'landscape');
```

Accepts any paper size/orientation string [dompdf's `setPaper()`](https://github.com/dompdf/dompdf/wiki/Usage) supports.

> **Note:** `PdfWriter` does not validate `paperSize`/`paperOrientation`. An invalid value (e.g. `paperSize: 'not-a-size'`) does not throw — dompdf silently falls back to letter/portrait. Pass values dompdf recognizes.

### Runtime note

[](#runtime-note)

`PdfWriter` relies on dompdf's font cache under `vendor/dompdf/dompdf/lib/fonts/` on first render for some font metadata. If that directory is read-only, rendering may trigger runtime errors or slower fallback behavior.

License
-------

[](#license)

MIT

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef298fbffac2225e36ab3a6e089af020f76885bc65d5f6afda831c64939e1e4b?d=identicon)[fissible](/maintainers/fissible)

---

Top Contributors

[![fissible](https://avatars.githubusercontent.com/u/1410914?v=4)](https://github.com/fissible "fissible (22 commits)")

---

Tags

pdfconverterdocxdompdftransmark

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fissible-transmark-pdf/health.svg)

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

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k104.2M430](/packages/barryvdh-laravel-dompdf)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.6k10](/packages/helsingborg-stad-municipio)[mnvx/lowrapper

PHP wrapper over LibreOffice converter

129205.2k](/packages/mnvx-lowrapper)[nucleos/dompdf-bundle

This bundle provides a wrapper for using dompdf inside symfony.

561.1M1](/packages/nucleos-dompdf-bundle)[dino/dompdf-module

A Zend Framework 2 module for incorporating DOMPDF support.

61472.3k8](/packages/dino-dompdf-module)[paperdoc-dev/paperdoc-lib

A zero-dependency PHP library for generating, parsing and converting documents — PDF, DOCX, XLSX, PPTX, HTML, Markdown, CSV and legacy Office formats

1315.4k](/packages/paperdoc-dev-paperdoc-lib)

PHPackages © 2026

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