There is no license information available for the latest version (4.1.1) of this package.

Convert HTML directly to PDF on the fly, using the mpdf or dompdf library.

Installs: 8 114

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 1

Forks: 3

Open Issues: 2


4.1.1 2021-08-09 18:42 UTC

This package is auto-updated.

Last update: 2021-10-09 19:03:48 UTC


This Package makes it possible to convert the rendered HTML directly to PDF on the fly, using the mpdf or dompdf library. To achieve the on the fly rendering easily it uses a fluid viewhelper.

You need one of these package installed via composer, the package itself checks if the library is missing and asks you to install it.

  • dompdf/dompdf
  • mpdf/mpdf

Controller Usage

The recent version of the package contains a new view. This view can be included directly in the controller e.g. like this:

class FormulareController extends \Neos\Flow\Mvc\Controller\ActionController {
	 * @Flow\Inject
	 * @var \SBS\LaPo\Domain\Repository\StudentRepository
	protected $studentRepository;

	 * @var array
	protected $viewFormatToObjectNameMap = array(
		'pdf.html' => 'KayStrobach\Pdf\View\PdfTemplateView'

This example uses the format pdf.html to make it easily possible to edit the template files with your favourite IDE.

Example usage in a FLOW Package called Some.Package

In a FLOW Layout you can wrap your generated HTML with the following ViewHelper and the output gets transformed into a PDF.

{namespace pdf=KayStrobach\Pdf\ViewHelpers}
<pdf:pdf enableHtml5Parser="1" disable="0" debug="1" dpi="120" renderer="mpdf">
	some html content

The parameter documentation can be obtained from the viewHelper directly see Classes/KayStrobach/Pdf/ViewHelpers/PdfViewHelper.php

A complete example may look like: (Taken from project/Packages/Application/Some.Package/Resources/Private/Layouts/Pdf.html)

{namespace pdf=KayStrobach\Pdf\ViewHelpers}
<pdf:pdf enableHtml5Parser="1" disable="0" debug="1" dpi="120" renderer="mpdf">
	<!DOCTYPE html>
	<html  xmlns:f="">
			<meta charset="utf-8">
			<title><f:render section="Title" /></title>
			<!-- Custom styles for this template -->
			<style type="text/css">
				table {
					border-collapse: collapse;

				table.formblock td{
					border: 0.1mm solid black;
					vertical-align: top;
					padding: 1mm;
					width: 50%;
					height: 8mm;
				table.formblock .halfcell {
					width: 25%;
				table.formblockAbstand {
					margin-top: 5mm;
				.label {
					font-size: 6pt;
			<f:base />
			<f:render section="Content" />

Defining headers and footers

Place this in the head

			@page {
				header: html_Header;
				footer: html_Footer;

and something like this in the body:

		<htmlpageheader name="Header">
			<div style="text-align: right; border-bottom: 1px solid #000000; font-weight: bold; font-size: 10pt;">
				<f:render section="Title" optional="1" />

		<htmlpagefooter name="Footer">
			<f:if condition="{f:render(section:'footer', optional:true)}">
					<f:render section="Title" optional="1" />
					<div style="text-align:center; border-top: 1px solid #000000;">
						<small>Seite {PAGENO} von {nbpg} - Ausdruck vom {DATE d.m.Y H:i}</small>

Rendering barcodes

<barcode code="{barcode}" type="C39" size="0.8" height="0.6" />