PHPackages                             decodelabs/imprint - 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. decodelabs/imprint

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

decodelabs/imprint
==================

PDF conversion API interface

v0.1.3(8mo ago)05MITPHPPHP ^8.4CI passing

Since Sep 9Pushed 5mo agoCompare

[ Source](https://github.com/decodelabs/imprint)[ Packagist](https://packagist.org/packages/decodelabs/imprint)[ RSS](/packages/decodelabs-imprint/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (6)Used By (0)

Imprint
=======

[](#imprint)

[![PHP from Packagist](https://camo.githubusercontent.com/a104361d98f0382be3f912f6ed49632f0e355ea941d5ba51e5c0078cd3e4b2f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6465636f64656c6162732f696d7072696e743f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/imprint)[![Latest Version](https://camo.githubusercontent.com/f2aab4bc35eabc0f28554aa2b76cb8d87ff56d65fe1b23c776d318db467b6552/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465636f64656c6162732f696d7072696e742e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/imprint)[![Total Downloads](https://camo.githubusercontent.com/894038cfefe38ab434af1245e8b9aa23fba34aa9245f59d619dd936f30ed03dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465636f64656c6162732f696d7072696e742e7376673f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/imprint)[![GitHub Workflow Status](https://camo.githubusercontent.com/5bcb7df0cff085dd8daae4e89ae3eebcd57ae5832a94e7d0932971a0105f5835/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6465636f64656c6162732f696d7072696e742f696e746567726174652e796d6c3f6272616e63683d646576656c6f70)](https://github.com/decodelabs/imprint/actions/workflows/integrate.yml)[![PHPStan](https://camo.githubusercontent.com/e25c14ce011edabdd0fbd2e10415b41cc5d66ed11ef3e5b7edd074c5bdd35a2d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d3434434331312e7376673f6c6f6e6743616368653d74727565267374796c653d666c6174)](https://github.com/phpstan/phpstan)[![License](https://camo.githubusercontent.com/679a8639a6d39b3725be91546a653e806ec7ef14d429f566fd4df3368571017a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6465636f64656c6162732f696d7072696e743f7374796c653d666c6174)](https://packagist.org/packages/decodelabs/imprint)

### PDF conversion API interface

[](#pdf-conversion-api-interface)

Imprint provides a simple and intuitive interface for converting HTML documents to PDF via various 3rd party services.

PDF generation is a notoriously difficult task requiring access to complex systems that require significant setup and resources. A number of services exist to handle this task, but each has their own unique API and set of features - Imprint fills the gap, abstracting the complexity away and making the whole process... less awful.

---

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

[](#installation)

This package requires PHP 8.4 or higher.

Install via Composer:

```
composer require decodelabs/imprint
```

Usage
-----

[](#usage)

Imprint uses the `Kingdom` `Service` interface for it's main entry point - if you are using a Service Container then you should provide an `Adapter` implementation to your Container at bootstrap:

```
use DecodeLabs\Dovetail\Env;
use DecodeLabs\Hydro;
use DecodeLabs\Imprint\Adapter;
use DecodeLabs\Imprint\Adapter\Doppio;

$pandora->setFactory(
    Adapter::class,
    fn () => new Doppio(
        $pandora->get(Hydro::class),
        Env::asString('DOPPIO_API_KEY'),
    )
)
```

### Adapters

[](#adapters)

Two adapters are currently supported: [Doppio](https://doppio.sh/) and [PdfLayer](https://pdflayer.com/). While more options will be added in the future, these two should cover most use cases. Doppio is likely to be the preferred choice as it uses headless Chromium to render the markup *exactly* as it would in a browser.

### Conversion

[](#conversion)

The Imprint `Service` has a number of methods for converting HTML documents to PDF, depending on the source and expected output format.

All of these methods accept an optional [`Options`](./src/Imprint/Options.php) object to control the conversion process. However, not all options are supported by all adapters - unsupported options will be ignored.

```
use DecodeLabs\Imprint;
use DecodeLabs\Imprint\Options;
use DecodeLabs\Imprint\Options\PageSize;
use DecodeLabs\Monarch;

$imprint = Monarch::getService(Imprint::class);

$options = new Options(
    marginTop: 10,
    marginBottom: 10,
    marginLeft: 10,
    marginRight: 10,
    pageSize: PageSize::A5,
);

// Returns an Atlas File\Local which has been saved to disk
$diskFile = $imprint->urlToLocalFile(
    'https://example.com/document.html',
    '/path/to/save/document.pdf', // Or Atlas File
    $options
);

$diskFile = $imprint->fileToLocalFile(
    '/path/to/document.html',
    '/path/to/save/document.pdf', // Or Atlas File
    $options
);

$diskFile = $imprint->stringToLocalFile(
    'Hello, world!',
    '/path/to/save/document.pdf', // Or Atlas File
    $options
);

// Returns an Atlas MemoryFile which can be used directly or saved to disk
$tempFile = $imprint->urlToTempFile(
    'https://example.com/document.html',
    'document.pdf',
    $options
);

$tempFile = $imprint->fileToTempFile(
    '/path/to/document.html',
    'document.pdf',
    $options
);

$tempFile = $imprint->stringToTempFile(
    'Hello, world!',
    'document.pdf',
    $options
);

// Returns a temporary URL on the service, only if supported by the adapter
$tempUrl = $imprint->urlToTempUrl(
    'https://example.com/document.html',
    'document.pdf',
    $options
);

$tempUrl = $imprint->fileToTempUrl(
    '/path/to/document.html',
    'document.pdf',
    $options
);

$tempUrl = $imprint->stringToTempUrl(
    'Hello, world!',
    'document.pdf',
    $options
);
```

Licensing
---------

[](#licensing)

Imprint is licensed under the MIT License. See [LICENSE](./LICENSE) for the full license text.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance66

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Total

4

Last Release

244d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a241d64d12b3b5ee94197862ec1ec30b82ed2efa34a0cd7f4c3565a021daddd?d=identicon)[betterthanclay](/maintainers/betterthanclay)

---

Top Contributors

[![betterthanclay](https://avatars.githubusercontent.com/u/1273586?v=4)](https://github.com/betterthanclay "betterthanclay (19 commits)")

### Embed Badge

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

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

###  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)[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)[asika/pdf2text

Simple PHP PDF to text class.

25828.1k](/packages/asika-pdf2text)

PHPackages © 2026

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