About RockPdf - mPDF helper module

mPDF helper module to easily create PDF files and make debugging easier.

Category Development Tools
Modules that have more to do with assisting development of a site rather than managing its content.
Release StateStable
Should be safe for use in production environments. *
Module Version1.0.1
Class NameRockPdf
Date AddedAugust 11, 2018
Last UpdatedNovember 27, 2019
Recommended ByNew recommendations may take up to 1 day to appear.


RockPdf is a wrapper for the mpdf library. Mpdf, as you may already know, is a commonly used PHP library that turns HTML content into PDF, complete with (at least basic) CSS styling, embedded images, and so on. While you could include the mpdf library directly in your code, accessing it through a module has some benefits:

First of all you have access to an instance of mpdf anywhere in your template or module files simply by calling $modules->get('RockPdf') – no need to include any additional files or anything like that.
RockPdf makes debugging layout issues notably easier by embedding parameters passed to its functions as HTML comments into the generated markup, and also by giving you an easy method to fetch the generated markup as-is.
While mpdf by default includes a massive blob of fonts, with RockPdf you get only the ones you really need – and you can still add more if needed, just by dropping the font files into specific directory.
Perhaps the most notable benefit from using RockPdf instead of directly including mpdf is related to the first bullet point above: by using RockPdf you get to keep your template and module files clean, and the API usage is always consistent. As an added bonus you also don't have to worry about keeping the mpdf library manually up to date.


This module's files should be placed in /site/modules/RockPdf/
How to install or uninstall modules