Adding a Custom Config
Custom config settings should be placed in your craft/config/printmaker.php file.
For example, if you want to set the default paper size and orientation, your
printmaker.php file might look like this:
<?php return array( 'defaultPaperSize' => 'a4', 'defaultOrientation' => 'landscape', );
You can return a single array of custom settings (as in the example above), or you can use Craft's Multi-Environment Config setup to make your custom settings dynamic on a per-environment basis.
If you don't need to override a particular setting, you can leave it out of your config file, or set its value to
Here is the definitive list of config settings you can add, and their default values:
The default page size:
'a4', or any of DOMPDF's other built-in sizes.
The default page orientation.
Whether to compress the PDF output. Accepts a boolean.
The default filename, sans .pdf extension.
The default extension for files saved to disk (i.e. using the
_Streamed files (i.e. using the
download output methods) will always carry a .pdf extension.
The path, relative to the document root, where printmaker Printmaker should cache saved PDFs.
For example, if your document root is,
/user/mysite.com/public and you specify
'cache/pdfs' as the cacheDirectory, your PDFs will be stored in
cacheUrl & cachePath
The absolute path and fully qualified URL to the directory where you want Printmaker to store saved PDFs. (These parameters take precedence over the cacheDirectory parameter and would come in handy if you have a special setup where you need to specify the absolute path and URL instead of using PHP's implicit document root.)
For example, if your document root is,
/user/mysite.com/public, you could specify
'/user/mysite.com/public/cache/pdfs' as the cachePath and
http://mysite.com/cache/pdfs as the cacheUrl.
Whether the PDF should be encrypted/password-protected. Accepts a boolean.
The user password. Accepts a string.
The owner password. Accepts a string.
Whether the PDF can be printed without being unlocked. Accepts a boolean.
Whether the PDF can be modified without being unlocked. Accepts a boolean.
Whether the PDF can be copied without being unlocked. Accepts a boolean.
Whether the PDF allows adding comments or pages without being unlocked. Accepts a boolean.
Whether Printmaker should allow DOMPDF to throw Exceptions if something goes wrong during PDF generation. This setting is similar to Craft's own
devMode config setting, and will be automatically set to
true if Craft is running in Dev Mode.
(This setting allows you to run Printmaker specifically in 'Dev Mode' even if Craft itself is not running in Dev Mode.)
The location of DOMPDF's temporary directory.
The directory specified must be writeable by the webserver process. The temporary directory is required to download remote images and when using the PFDLib back-end.
The location of the directory where DOMPDF will store fonts and font metrics.
This directory must exist and be writable by the web server process.
The location of the DOMPDF font cache directory
This directory contains the cached font metrics for the fonts used by DOMPDF. This directory can be the same as
This directory must exist and be writable by the webserver process.
The log file DOMPDF will use to log its debugging events.
The HTML target media view which should be rendered into PDF.
These standard HTML Media Descriptors (http://www.w3.org/TR/REC-html40/types.html) are available:
aural is deprecated in CSS 2.1 because it is replaced by
speech in CSS 3.
Even though the generated PDF file is intended for print output, the target stylesheets and content might be different (e.g.
This setting determines the default DPI setting for images and fonts.
The DPI may be overridden for inline images by explictly setting the image's width & height style attributes. For example, if an image's native width is 600 pixels and you specify the image's width as 72 points, the image will have a DPI of 600 in the rendered PDF.
The DPI of background images can not be overridden and is controlled entirely via this parameter.
For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
If a size in html is given as px (or without unit as image size), this determines the corresponding size in pt at 72 DPI. (This adjusts the relative sizes to be similar to the rendering of the HTML page in a reference browser.
In PDF, 1 pt = 1/72 inch.
A ratio applied to the fonts' height to normalize them to a reference browser's line height.
If this setting is set to true then DOMPDF will automatically evaluate embedded PHP contained within
<script type="text/php"> ... </script> tags.
**Enabling `isPhpEnabled` for documents you do not trust (e.g. arbitrary remote HTML pages) is a security risk. Embedded scripts are run with the same level of system access available to Printmaker. Leave this option set to `false` if you intend to process untrusted documents.**
If this setting is set to true, DOMPDF will access remote sites for images and CSS files as required.
This can be a security risk, particularly in combination with `isPhpEnabled`, as this could allow anonymous users to download dubious internet content using your server as a proxy, and it could allow malicious PHP code in remote pages to be executed by your server with your account privileges.
This setting is enabled by default because Craft generates fully qualified URLs for Assets, so the vast majority of customers need to support remote content, even when that "remote content" is being served from their own servers. Additionally, this allows Printmaker to use content from remote Asset Sources like Amazon S3, as well as content served by CDN.
If you're able to, it's best to disable this setting to help lock down your server.
DOMPDF includes the experimental HTML5 Lib parser. The HTML5 parser is not as mature as the default parser, but may be more tolerant of poorly-formed HTML.
Whether to enable font subsetting in DOMPDF.
debugX parameters adjust DOMPDF's internal debugging behavior. It isn't likely that you'll need to change these, but they're exposed just in case you really know what you're doing and want to mess with stuff.