4 * Export 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 $snappyPaperSizeMap = [
16 $dompdfPaperSizeMap = [
21 $exportPageSize = env('EXPORT_PAGE_SIZE', 'a4');
25 // Set a command which can be used to convert a HTML file into a PDF file.
26 // When false this will not be used.
27 // String values represent the command to be called for conversion.
28 // Supports '{input_html_path}' and '{output_pdf_path}' placeholder values.
29 // Example: EXPORT_PDF_COMMAND="/scripts/convert.sh {input_html_path} {output_pdf_path}"
30 'pdf_command' => env('EXPORT_PDF_COMMAND', false),
32 // The amount of time allowed for PDF generation command to run
33 // before the process times out and is stopped.
34 'pdf_command_timeout' => env('EXPORT_PDF_COMMAND_TIMEOUT', 15),
36 // 2024-04: Snappy/WKHTMLtoPDF now considered deprecated in regard to BookStack support.
38 'pdf_binary' => env('WKHTMLTOPDF', false),
40 'print-media-type' => true,
42 'page-size' => $snappyPaperSizeMap[$exportPageSize] ?? 'A4',
48 * The location of the DOMPDF font directory.
50 * The location of the directory where DOMPDF will store fonts and font metrics
51 * Note: This directory must exist and be writable by the webserver process.
52 * *Please note the trailing slash.*
54 * Notes regarding fonts:
55 * Additional .afm font metrics can be added by executing load_font.php from command line.
57 * Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
58 * be embedded in the pdf file or the PDF may not display correctly. This can significantly
59 * increase file size unless font subsetting is enabled. Before embedding a font please
60 * review your rights under the font license.
62 * Any font specification in the source HTML is translated to the closest font available
63 * in the font directory.
65 * The pdf standard "Base 14 fonts" are:
66 * Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
67 * Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
68 * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
69 * Symbol, ZapfDingbats.
71 'font_dir' => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
74 * The location of the DOMPDF font cache directory.
76 * This directory contains the cached font metrics for the fonts used by DOMPDF.
77 * This directory can be the same as DOMPDF_FONT_DIR
79 * Note: This directory must exist and be writable by the webserver process.
81 'font_cache' => storage_path('fonts/'),
84 * The location of a temporary directory.
86 * The directory specified must be writeable by the webserver process.
87 * The temporary directory is required to download remote images and when
88 * using the PFDLib back end.
90 'temp_dir' => sys_get_temp_dir(),
93 * ==== IMPORTANT ====.
95 * dompdf's "chroot": Prevents dompdf from accessing system files or other
96 * files on the webserver. All local files opened by dompdf must be in a
97 * subdirectory of this directory. DO NOT set it to '/' since this could
98 * allow an attacker to use dompdf to read any files on the server. This
99 * should be an absolute path.
100 * This is only checked on command line call by dompdf.php, but not by
101 * direct class use like:
102 * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
104 'chroot' => realpath(public_path()),
107 * Protocol whitelist.
109 * Protocols and PHP wrappers allowed in URIs, and the validation rules
110 * that determine if a resouce may be loaded. Full support is not guaranteed
111 * for the protocols/wrappers specified
116 'allowed_protocols' => [
117 "data://" => ["rules" => []],
118 'file://' => ['rules' => []],
119 'http://' => ['rules' => []],
120 'https://' => ['rules' => []],
126 'log_output_file' => null,
129 * Whether to enable font subsetting or not.
131 'enable_font_subsetting' => false,
134 * The PDF rendering backend to use.
136 * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
137 * 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
138 * fall back on CPDF. 'GD' renders PDFs to graphic files. {@link * Canvas_Factory} ultimately determines which rendering class to instantiate
139 * based on this setting.
141 * Both PDFLib & CPDF rendering backends provide sufficient rendering
142 * capabilities for dompdf, however additional features (e.g. object,
143 * image and font support, etc.) differ between backends. Please see
144 * {@link PDFLib_Adapter} for more information on the PDFLib backend
145 * and {@link CPDF_Adapter} and lib/class.pdf.php for more information
146 * on CPDF. Also see the documentation for each backend at the links
149 * The GD rendering backend is a little different than PDFLib and
150 * CPDF. Several features of CPDF and PDFLib are not supported or do
151 * not make any sense when creating image files. For example,
152 * multiple pages are not supported, nor are PDF 'objects'. Have a
153 * look at {@link GD_Adapter} for more information. GD support is
154 * experimental, so use it at your own risk.
156 * @link http://www.pdflib.com
157 * @link http://www.ros.co.nz/pdf
158 * @link http://www.php.net/image
160 'pdf_backend' => 'CPDF',
163 * PDFlib license key.
165 * If you are using a licensed, commercial version of PDFlib, specify
166 * your license key here. If you are using PDFlib-Lite or are evaluating
167 * the commercial version of PDFlib, comment out this setting.
169 * @link http://www.pdflib.com
171 * If pdflib present in web server and auto or selected explicitely above,
172 * a real license code must exist!
174 //"DOMPDF_PDFLIB_LICENSE" => "your license key here",
177 * html target media view which should be rendered into pdf.
178 * List of types and parsing rules for future extensions:
179 * http://www.w3.org/TR/REC-html40/types.html
180 * screen, tty, tv, projection, handheld, print, braille, aural, all
181 * Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
182 * Note, even though the generated pdf file is intended for print output,
183 * the desired content might be different (e.g. screen or projection view of html file).
184 * Therefore allow specification of content here.
186 'default_media_type' => 'print',
189 * The default paper size.
191 * North America standard is "letter"; other countries generally "a4"
193 * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
195 'default_paper_size' => $dompdfPaperSizeMap[$exportPageSize] ?? 'a4',
198 * The default paper orientation.
200 * The orientation of the page (portrait or landscape).
204 'default_paper_orientation' => 'portrait',
207 * The default font family.
209 * Used if no suitable fonts can be found. This must exist in the font folder.
213 'default_font' => 'dejavu sans',
218 * This setting determines the default DPI setting for images and fonts. The
219 * DPI may be overridden for inline images by explictly setting the
220 * image's width & height style attributes (i.e. if the image's native
221 * width is 600 pixels and you specify the image's width as 72 points,
222 * the image will have a DPI of 600 in the rendered PDF. The DPI of
223 * background images can not be overridden and is controlled entirely
224 * via this parameter.
226 * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
227 * If a size in html is given as px (or without unit as image size),
228 * this tells the corresponding size in pt.
229 * This adjusts the relative sizes to be similar to the rendering of the
230 * html page in a reference browser.
232 * In pdf, always 1 pt = 1/72 inch
234 * Rendering resolution of various browsers in px per inch:
235 * Windows Firefox and Internet Explorer:
236 * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
238 * about:config *resolution: Default:96
239 * (xorg screen dimension in mm and Desktop font dpi settings are ignored)
241 * Take care about extra font/image zoom factor of browser.
243 * In images, <img> size in pixel attribute, img css style, are overriding
244 * the real image dimension in px for rendering.
253 * If this setting is set to true then DOMPDF will automatically evaluate
254 * inline PHP contained within <script type="text/php"> ... </script> tags.
256 * Enabling this for documents you do not trust (e.g. arbitrary remote html
257 * pages) is a security risk. Set this option to false if you wish to process
258 * untrusted documents.
262 'enable_php' => false,
265 * Enable inline Javascript.
267 * If this setting is set to true then DOMPDF will automatically insert
268 * JavaScript code contained within <script type="text/javascript"> ... </script> tags.
272 'enable_javascript' => false,
275 * Enable remote file access.
277 * If this setting is set to true, DOMPDF will access remote sites for
278 * images and CSS files as required.
279 * This is required for part of test case www/test/image_variants.html through www/examples.php
282 * This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
283 * allowing remote access to dompdf.php or on allowing remote html code to be passed to
284 * $dompdf = new DOMPDF(, $dompdf->load_html(...,
285 * This allows anonymous users to download legally doubtful internet content which on
286 * tracing back appears to being downloaded by your server, or allows malicious php code
287 * in remote html pages to be executed by your server with your account privileges.
291 'enable_remote' => env('ALLOW_UNTRUSTED_SERVER_FETCHING', false),
294 * A ratio applied to the fonts height to be more like browsers' line height.
296 'font_height_ratio' => 1.1,
299 * Use the HTML5 Lib parser.
301 * @deprecated This feature is now always on in dompdf 2.x
305 'enable_html5_parser' => true,