4 * DOMPDF configuration options.
6 * Changes to these config files are not supported by BookStack and may break upon updates.
7 * Configuration should be altered via the `.env` file or environment variables.
8 * Do not edit this file unless you're happy to maintain any changes yourself.
11 $dompdfPaperSizeMap = [
18 'show_warnings' => false, // Throw an Exception on warnings from dompdf
19 'orientation' => 'portrait',
22 * The location of the DOMPDF font directory.
24 * The location of the directory where DOMPDF will store fonts and font metrics
25 * Note: This directory must exist and be writable by the webserver process.
26 * *Please note the trailing slash.*
28 * Notes regarding fonts:
29 * Additional .afm font metrics can be added by executing load_font.php from command line.
31 * Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
32 * be embedded in the pdf file or the PDF may not display correctly. This can significantly
33 * increase file size unless font subsetting is enabled. Before embedding a font please
34 * review your rights under the font license.
36 * Any font specification in the source HTML is translated to the closest font available
37 * in the font directory.
39 * The pdf standard "Base 14 fonts" are:
40 * Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
41 * Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
42 * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
43 * Symbol, ZapfDingbats.
45 'font_dir' => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
48 * The location of the DOMPDF font cache directory.
50 * This directory contains the cached font metrics for the fonts used by DOMPDF.
51 * This directory can be the same as DOMPDF_FONT_DIR
53 * Note: This directory must exist and be writable by the webserver process.
55 'font_cache' => storage_path('fonts/'),
58 * The location of a temporary directory.
60 * The directory specified must be writeable by the webserver process.
61 * The temporary directory is required to download remote images and when
62 * using the PFDLib back end.
64 'temp_dir' => sys_get_temp_dir(),
67 * ==== IMPORTANT ====.
69 * dompdf's "chroot": Prevents dompdf from accessing system files or other
70 * files on the webserver. All local files opened by dompdf must be in a
71 * subdirectory of this directory. DO NOT set it to '/' since this could
72 * allow an attacker to use dompdf to read any files on the server. This
73 * should be an absolute path.
74 * This is only checked on command line call by dompdf.php, but not by
75 * direct class use like:
76 * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
78 'chroot' => realpath(public_path()),
81 * Whether to use Unicode fonts or not.
83 * When set to true the PDF backend must be set to "CPDF" and fonts must be
84 * loaded via load_font.php.
86 * When enabled, dompdf can support all Unicode glyphs. Any glyphs used in a
87 * document must be present in your fonts, however.
89 'unicode_enabled' => true,
92 * Whether to enable font subsetting or not.
94 'enable_fontsubsetting' => false,
97 * The PDF rendering backend to use.
99 * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
100 * 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
101 * fall back on CPDF. 'GD' renders PDFs to graphic files. {@link * Canvas_Factory} ultimately determines which rendering class to instantiate
102 * based on this setting.
104 * Both PDFLib & CPDF rendering backends provide sufficient rendering
105 * capabilities for dompdf, however additional features (e.g. object,
106 * image and font support, etc.) differ between backends. Please see
107 * {@link PDFLib_Adapter} for more information on the PDFLib backend
108 * and {@link CPDF_Adapter} and lib/class.pdf.php for more information
109 * on CPDF. Also see the documentation for each backend at the links
112 * The GD rendering backend is a little different than PDFLib and
113 * CPDF. Several features of CPDF and PDFLib are not supported or do
114 * not make any sense when creating image files. For example,
115 * multiple pages are not supported, nor are PDF 'objects'. Have a
116 * look at {@link GD_Adapter} for more information. GD support is
117 * experimental, so use it at your own risk.
119 * @link http://www.pdflib.com
120 * @link http://www.ros.co.nz/pdf
121 * @link http://www.php.net/image
123 'pdf_backend' => 'CPDF',
126 * PDFlib license key.
128 * If you are using a licensed, commercial version of PDFlib, specify
129 * your license key here. If you are using PDFlib-Lite or are evaluating
130 * the commercial version of PDFlib, comment out this setting.
132 * @link http://www.pdflib.com
134 * If pdflib present in web server and auto or selected explicitely above,
135 * a real license code must exist!
137 //"DOMPDF_PDFLIB_LICENSE" => "your license key here",
140 * html target media view which should be rendered into pdf.
141 * List of types and parsing rules for future extensions:
142 * http://www.w3.org/TR/REC-html40/types.html
143 * screen, tty, tv, projection, handheld, print, braille, aural, all
144 * Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
145 * Note, even though the generated pdf file is intended for print output,
146 * the desired content might be different (e.g. screen or projection view of html file).
147 * Therefore allow specification of content here.
149 'default_media_type' => 'print',
152 * The default paper size.
154 * North America standard is "letter"; other countries generally "a4"
156 * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
158 'default_paper_size' => $dompdfPaperSizeMap[env('EXPORT_PAGE_SIZE', 'a4')] ?? 'a4',
161 * The default font family.
163 * Used if no suitable fonts can be found. This must exist in the font folder.
167 'default_font' => 'dejavu sans',
172 * This setting determines the default DPI setting for images and fonts. The
173 * DPI may be overridden for inline images by explictly setting the
174 * image's width & height style attributes (i.e. if the image's native
175 * width is 600 pixels and you specify the image's width as 72 points,
176 * the image will have a DPI of 600 in the rendered PDF. The DPI of
177 * background images can not be overridden and is controlled entirely
178 * via this parameter.
180 * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
181 * If a size in html is given as px (or without unit as image size),
182 * this tells the corresponding size in pt.
183 * This adjusts the relative sizes to be similar to the rendering of the
184 * html page in a reference browser.
186 * In pdf, always 1 pt = 1/72 inch
188 * Rendering resolution of various browsers in px per inch:
189 * Windows Firefox and Internet Explorer:
190 * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
192 * about:config *resolution: Default:96
193 * (xorg screen dimension in mm and Desktop font dpi settings are ignored)
195 * Take care about extra font/image zoom factor of browser.
197 * In images, <img> size in pixel attribute, img css style, are overriding
198 * the real image dimension in px for rendering.
207 * If this setting is set to true then DOMPDF will automatically evaluate
208 * inline PHP contained within <script type="text/php"> ... </script> tags.
210 * Enabling this for documents you do not trust (e.g. arbitrary remote html
211 * pages) is a security risk. Set this option to false if you wish to process
212 * untrusted documents.
216 'enable_php' => false,
219 * Enable inline Javascript.
221 * If this setting is set to true then DOMPDF will automatically insert
222 * JavaScript code contained within <script type="text/javascript"> ... </script> tags.
226 'enable_javascript' => false,
229 * Enable remote file access.
231 * If this setting is set to true, DOMPDF will access remote sites for
232 * images and CSS files as required.
233 * This is required for part of test case www/test/image_variants.html through www/examples.php
236 * This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
237 * allowing remote access to dompdf.php or on allowing remote html code to be passed to
238 * $dompdf = new DOMPDF(, $dompdf->load_html(...,
239 * This allows anonymous users to download legally doubtful internet content which on
240 * tracing back appears to being downloaded by your server, or allows malicious php code
241 * in remote html pages to be executed by your server with your account privileges.
245 'enable_remote' => env('ALLOW_UNTRUSTED_SERVER_FETCHING', false),
248 * A ratio applied to the fonts height to be more like browsers' line height.
250 'font_height_ratio' => 1.1,
255 * Allows people to disabled CSS float support
259 'enable_css_float' => true,
262 * Use the more-than-experimental HTML5 Lib parser.
264 'enable_html5parser' => true,