Config

Last updated: November 6th 2023

You can modify all default settings by creating super-pdf.php file to store all your default configuration.

Settings

type

Select default type of PDF.

  • If you want to render PDF, You can set render
  • If you want to get URL of PDF file, You can set object
    • object type will return SuperPdf's model if pdf storage path is set to storage folder
    • object type will return Assets element object if storage path is set to craft's volume.

forceDownload

Set this to true if you want to download pdf directly instead of showing it.

[Note: Default value is false]

compress

Set this to true if you want to apply content stream compression.

[Note: Default value is true]

rootDir

The root of your DOMPDF installation

tempDir

The location of a temporary directory.

The directory specified must be writable by the webserver process. The temporary directory is required to download remote images and when using the PFDLib back end.

fontDir

The location of the DOMPDF font directory.

The location of the directory where DOMPDF will store fonts and font metrics.

[Note: This directory must exist and be writable by the webserver process.]

fontCache

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 $fontDir

[Note: This directory must exist and be writable by the webserver process.]

defaultMediaType

html target media view which should be rendered into pdf.

Available options including future updates: [screen, tty, tv, projection, handheld, print, braille, aural, all]

Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.

Note: even though the generated pdf file is intended for print output, the desired content might be different (e.g. screen or projection view of html file).

[Note: Default value is screen]

defaultPaperSize

The default paper size setting.

North America standard is "letter"; other countries generally "a4".

[Note: Default value is A4]

defaultPaperOrientation

The orientation of the page (portrait or landscape).

[Note: Default value is portrait]

defaultFont

The default font family. Used if no suitable fonts can be found. This must exist in the font folder.

[Note: Default value is arial]

dpi

Image DPI setting.

This setting determines the default DPI setting for images and fonts. The DPI may be overridden for inline images by explicitly setting the image's width & height style attributes (i.e. if the 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 tells 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.

[Note: In pdf, always 1 pt = 1/72 inch]

[Note: Default value is 96]

fontHeightRatio

A ratio applied to the fonts height to be more like browsers' line height.

[Note: Default value is 1.1]

isPhpEnabled

If this setting is set to true then DOMPDF will automatically evaluate embedded PHP contained within <script type="text/php"> ... </script> tags.

[Note: Default value is false]

isRemoteEnabled

If this setting is set to true, DOMPDF will access remote sites for images and CSS files as required.

[Note: Default value is true]

isJavascriptEnabled

If this setting is set to true then DOMPDF will automatically insert JavaScript code contained within <script type="text/javascript"> ... </script> tags.

[Note: Default value is false]

isHtml5ParserEnabled

Use the more-than-experimental HTML5 Lib parser.

[Note: Default value is true]

isFontSubsettingEnabled

Whether to enable font subsetting or not.

[Note: Default value is true]

pdfBackend

The PDF rendering backend to use. Valid settings are 'PDFLib', 'CPDF', 'GD', and 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will fall back on CPDF. 'GD' renders PDFs to graphic files.

password

Password for password protected PDF files.

[Note: A PDF can be set as password protected only if you have encrypt variable set as true.]

[Note: Default password is password]

adminPassword

This is master password to open the password protected PDF files. If you dont know password, You can use admin password to unlock the file.

[Note: As default, there is no admin password. You can set it in settings if you want to.]

filename

Name of your PDF file.

[Note: Default value is pdf]

encrypt

Enable this if you want to make your PDF password protected.

[Note: Default value is false]

print

Enable this if you allow password protected PDF file to be printed without entering password.

[Note: Default value is false]

modify

Enable this if you allow password protected PDF file to be modify without entering password.

[Note: Default value is false]

copy

Enable this if you allow to copy data in password protected PDF file without entering password.

[Note: Default value is false]

add

Enable this if you allow to add comments etc. to password protected PDF file without entering password.

[Note: Default value is false]