PHPackages                             opus4-repo/opus4-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. opus4-repo/opus4-pdf

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

opus4-repo/opus4-pdf
====================

OPUS 4 PDF Support Library

4.8.0.3(6mo ago)08.6k↓33.3%1[15 issues](https://github.com/OPUS4/opus4-pdf/issues)GPL-2.0+PHPPHP &gt;=8.1CI passing

Since Mar 22Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/OPUS4/opus4-pdf)[ Packagist](https://packagist.org/packages/opus4-repo/opus4-pdf)[ Docs](https://www.opus-repository.org)[ RSS](/packages/opus4-repo-opus4-pdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (10)Versions (7)Used By (0)

opus4-pdf
=========

[](#opus4-pdf)

This package provides PDF support in OPUS 4 for instance to generate cover sheets or validate files.

([Deutsche Dokumentation](LIESMICH.md))

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

[](#requirements)

### XeTeX and Pandoc

[](#xetex-and-pandoc)

The opus4-pdf package currently requires [XeTeX](https://xetex.sourceforge.net/) and [Pandoc](https://pandoc.org/) to generate PDF cover sheets.

In Ubuntu / Debian based Linux systems, these tools can be installed using `apt` or `apt-get`:

```
$ apt-get install texlive-xetex
$ apt-get install pandoc

```

In case of Pandoc, please ensure that you install / use at least version 2.17. The current implementation was not tested against older Pandoc versions.

To check the version of Pandoc that has been installed, run:

```
$ pandoc -v

```

### Fonts

[](#fonts)

PDF cover sheets will be generated via template files. Note that the included `demo-cover.md`file requires the "Open Sans" (true type or open type) font to be installed on the system. This font is available under the Apache License v.2.0 in the [Google Fonts library](https://fonts.google.com/specimen/Open+Sans). Alternatively, it can be obtained under the SIL Open Font License 1.1 from [bunny.net](https://fonts.bunny.net/family/open-sans).

The `Vagrantfile` file gives an example on how fonts can be installed on Ubuntu/Debian-based Linux systems from the command line.

### Unit tests

[](#unit-tests)

In order to run the unit tests the system must also meet the following basic requirements:

- PHP &gt;= 7.1 with PHP support for cURL, DOM and MySQL
- MySQL &gt; 5.1

Dependencies
------------

[](#dependencies)

Further dependencies are declared in `composer.json` and can be downloaded automatically using

```
composer install

```

or

```
php composer.phar install

```

This will cause the required packages to get downloaded and installed in the `vendor` directory.

The script `bin/install-composer.sh` can be used to automatically download `composer.phar`, so the most recent version can be used. [Composer](https://getcomposer.org) is also available in most Linux distributions.

Integration with OPUS 4
-----------------------

[](#integration-with-opus-4)

Besides the above mentioned requirements, perform the following steps in order to enable PDF cover sheet generation for your OPUS 4 installation.

### Setting configuration options

[](#setting-configuration-options)

By default, PDF cover sheet generation is disabled. To enable PDF cover sheet generation, add the following configuration options to your application's `config.ini` file:

```
pdf.covers.generate = 1

```

This will cause PDF cover sheets to be added in front of PDF files downloaded via the OPUS 4 frontdoor.

By default, OPUS 4 looks for PDF cover templates in the `application/configs/covers` directory. You can optionally specify a different directory path via this configuration option:

```
pdf.covers.path = APPLICATION_PATH "/application/configs/covers"

```

This package contains a simple demo cover template in the `test/_files` directory which can be used as the base for any custom template. To use this demo cover template, put this template into the covers directory that you've specified for `pdf.covers.path`, and add this option:

```
pdf.covers.default = 'demo-cover.md'

```

If you've created a custom PDF cover template replace the value for the `pdf.covers.default`option with your template's file name (or path relative to the covers directory if your template is located in its own subdirectory).

You may optionally specify different cover templates to be used for certain OPUS 4 collections. To do so, you can map a collection-specific cover template to a certain collection ID:

```
collection.12345.cover = 'my-cover.md'

```

Replace `12345` with the actual ID of your collection and `my-cover.md` with the actual name of your collection-specific cover template (or its relative path if it's located within a subdirectory).

### Displaying licence logos

[](#displaying-licence-logos)

Currently, the PDF cover sheet generation process can only make use of image files that are available locally.

By default, the application looks for licence logos within a `public/img/licences` directory, but you can also specify another directory via the `licences.logos.path` option:

```
licences.logos.path = APPLICATION_PATH "/public/img/licences"

```

Inside the specified licences directory, OPUS 4 expects licence logos at a path that matches the URL path given for the licence in its database table. For example, if the `link_logo` column in the OPUS database table `document_licences` contains this logo URL:

```
https://licensebuttons.net/l/by-sa/4.0/88x31.png

```

OPUS 4 would expect the local representation of that licence logo at:

```
public/img/licences/l/by-sa/4.0/88x31.png

```

Running the unit tests
----------------------

[](#running-the-unit-tests)

With [Vagrant](https://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) installed, the included `Vagrantfile` can be used to install all requirements and Composer dependencies in a virtual machine.

The unit tests can then be run via these commands:

```
$ cd opus4-pdf
$ vagrant up
$ vagrant ssh
$ composer test

```

Creating custom PDF cover templates
-----------------------------------

[](#creating-custom-pdf-cover-templates)

In the application, downloaded files that include a cover sheet get cached in the `workspace/filecache` directory (original files will not be modified). As long as a cached version exists and the document of the file doesn't change, the cached version will be delivered on subsequent download requests.

The `opus4` console tool includes a `cover:generate` command which will generate a PDF cover for a given document ID. This command will always force a rebuild of the cover sheet which can be useful when developing a custom cover template.

To display the command's help, execute this command on the console:

```
bin/opus4 help cover:generate

```

In order to generate a PDF cover for a document using the current default template, execute this command:

```
bin/opus4 cover:generate ID

```

Replace `ID` with the document's actual ID. The generated PDF cover will be written to the current working directory using the document's ID as its file name. You can use the `--out` option to specify a different file name, e.g. "cover.pdf":

```
bin/opus4 cover:generate --out=cover.pdf ID

```

Finally, you can use the `--template` option to specify the path to a custom cover template, e.g.:

```
bin/opus4 cover:generate --out=cover.pdf --template=./application/configs/covers/my-cover.md ID

```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance75

Regular maintenance activity

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 61.8% 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 ~266 days

Recently: every ~236 days

Total

6

Last Release

188d ago

Major Versions

0.1 → 4.7.12023-04-11

PHP version history (2 changes)4.8.0.2PHP &gt;=7.1

4.8.0.3PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1cd34fe319a70c5373c10cf610135749b4894dec16ee47e94de09f1de5aef1cc?d=identicon)[opus4kobv](/maintainers/opus4kobv)

---

Top Contributors

[![extracts](https://avatars.githubusercontent.com/u/1410036?v=4)](https://github.com/extracts "extracts (152 commits)")[![j3nsch](https://avatars.githubusercontent.com/u/8101870?v=4)](https://github.com/j3nsch "j3nsch (94 commits)")

---

Tags

pdfopus4

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opus4-repo-opus4-pdf/health.svg)

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

###  Alternatives

[knplabs/knp-snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.

4.5k68.3M56](/packages/knplabs-knp-snappy)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[chrome-php/chrome

Instrument headless chrome/chromium instances from PHP

2.6k4.5M64](/packages/chrome-php-chrome)[easybook/easybook

Book publishing application

76011.5k](/packages/easybook-easybook)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

761.1M7](/packages/pontedilana-php-weasyprint)[mostafaznv/pdf-optimizer

PDF optimization tool for PHP and Laravel applications

170125.8k](/packages/mostafaznv-pdf-optimizer)

PHPackages © 2026

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