]> BookStack Code Mirror - bookstack/blob - config/dompdf.php
Hide permissions table unless custom permissions are enabled
[bookstack] / config / dompdf.php
1 <?php
2
3 /**
4  * DOMPDF configuration options.
5  *
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.
9  */
10
11 return [
12
13
14     'show_warnings' => false,   // Throw an Exception on warnings from dompdf
15     'orientation' => 'portrait',
16     'defines' => [
17         /**
18          * The location of the DOMPDF font directory
19          *
20          * The location of the directory where DOMPDF will store fonts and font metrics
21          * Note: This directory must exist and be writable by the webserver process.
22          * *Please note the trailing slash.*
23          *
24          * Notes regarding fonts:
25          * Additional .afm font metrics can be added by executing load_font.php from command line.
26          *
27          * Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
28          * be embedded in the pdf file or the PDF may not display correctly. This can significantly
29          * increase file size unless font subsetting is enabled. Before embedding a font please
30          * review your rights under the font license.
31          *
32          * Any font specification in the source HTML is translated to the closest font available
33          * in the font directory.
34          *
35          * The pdf standard "Base 14 fonts" are:
36          * Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
37          * Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
38          * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
39          * Symbol, ZapfDingbats.
40          */
41         "DOMPDF_FONT_DIR" => app_path('vendor/dompdf/dompdf/lib/fonts/'), //storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
42
43         /**
44          * The location of the DOMPDF font cache directory
45          *
46          * This directory contains the cached font metrics for the fonts used by DOMPDF.
47          * This directory can be the same as DOMPDF_FONT_DIR
48          *
49          * Note: This directory must exist and be writable by the webserver process.
50          */
51         "DOMPDF_FONT_CACHE" => storage_path('fonts/'),
52
53         /**
54          * The location of a temporary directory.
55          *
56          * The directory specified must be writeable by the webserver process.
57          * The temporary directory is required to download remote images and when
58          * using the PFDLib back end.
59          */
60         "DOMPDF_TEMP_DIR" => sys_get_temp_dir(),
61
62         /**
63          * ==== IMPORTANT ====
64          *
65          * dompdf's "chroot": Prevents dompdf from accessing system files or other
66          * files on the webserver.  All local files opened by dompdf must be in a
67          * subdirectory of this directory.  DO NOT set it to '/' since this could
68          * allow an attacker to use dompdf to read any files on the server.  This
69          * should be an absolute path.
70          * This is only checked on command line call by dompdf.php, but not by
71          * direct class use like:
72          * $dompdf = new DOMPDF();      $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
73          */
74         "DOMPDF_CHROOT" => realpath(base_path()),
75
76         /**
77          * Whether to use Unicode fonts or not.
78          *
79          * When set to true the PDF backend must be set to "CPDF" and fonts must be
80          * loaded via load_font.php.
81          *
82          * When enabled, dompdf can support all Unicode glyphs. Any glyphs used in a
83          * document must be present in your fonts, however.
84          */
85         "DOMPDF_UNICODE_ENABLED" => true,
86
87         /**
88          * Whether to enable font subsetting or not.
89          */
90         "DOMPDF_ENABLE_FONTSUBSETTING" => false,
91
92         /**
93          * The PDF rendering backend to use
94          *
95          * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
96          * 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
97          * fall back on CPDF. 'GD' renders PDFs to graphic files. {@link
98          * Canvas_Factory} ultimately determines which rendering class to instantiate
99          * based on this setting.
100          *
101          * Both PDFLib & CPDF rendering backends provide sufficient rendering
102          * capabilities for dompdf, however additional features (e.g. object,
103          * image and font support, etc.) differ between backends.  Please see
104          * {@link PDFLib_Adapter} for more information on the PDFLib backend
105          * and {@link CPDF_Adapter} and lib/class.pdf.php for more information
106          * on CPDF. Also see the documentation for each backend at the links
107          * below.
108          *
109          * The GD rendering backend is a little different than PDFLib and
110          * CPDF. Several features of CPDF and PDFLib are not supported or do
111          * not make any sense when creating image files.  For example,
112          * multiple pages are not supported, nor are PDF 'objects'.  Have a
113          * look at {@link GD_Adapter} for more information.  GD support is
114          * experimental, so use it at your own risk.
115          *
116          * @link http://www.pdflib.com
117          * @link http://www.ros.co.nz/pdf
118          * @link http://www.php.net/image
119          */
120         "DOMPDF_PDF_BACKEND" => "CPDF",
121
122         /**
123          * PDFlib license key
124          *
125          * If you are using a licensed, commercial version of PDFlib, specify
126          * your license key here.  If you are using PDFlib-Lite or are evaluating
127          * the commercial version of PDFlib, comment out this setting.
128          *
129          * @link http://www.pdflib.com
130          *
131          * If pdflib present in web server and auto or selected explicitely above,
132          * a real license code must exist!
133          */
134         //"DOMPDF_PDFLIB_LICENSE" => "your license key here",
135
136         /**
137          * html target media view which should be rendered into pdf.
138          * List of types and parsing rules for future extensions:
139          * http://www.w3.org/TR/REC-html40/types.html
140          *   screen, tty, tv, projection, handheld, print, braille, aural, all
141          * Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
142          * Note, even though the generated pdf file is intended for print output,
143          * the desired content might be different (e.g. screen or projection view of html file).
144          * Therefore allow specification of content here.
145          */
146         "DOMPDF_DEFAULT_MEDIA_TYPE" => "print",
147
148         /**
149          * The default paper size.
150          *
151          * North America standard is "letter"; other countries generally "a4"
152          *
153          * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
154          */
155         "DOMPDF_DEFAULT_PAPER_SIZE" => "a4",
156
157         /**
158          * The default font family
159          *
160          * Used if no suitable fonts can be found. This must exist in the font folder.
161          * @var string
162          */
163         "DOMPDF_DEFAULT_FONT" => "dejavu sans",
164
165         /**
166          * Image DPI setting
167          *
168          * This setting determines the default DPI setting for images and fonts.  The
169          * DPI may be overridden for inline images by explictly setting the
170          * image's width & height style attributes (i.e. if the image's native
171          * width is 600 pixels and you specify the image's width as 72 points,
172          * the image will have a DPI of 600 in the rendered PDF.  The DPI of
173          * background images can not be overridden and is controlled entirely
174          * via this parameter.
175          *
176          * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
177          * If a size in html is given as px (or without unit as image size),
178          * this tells the corresponding size in pt.
179          * This adjusts the relative sizes to be similar to the rendering of the
180          * html page in a reference browser.
181          *
182          * In pdf, always 1 pt = 1/72 inch
183          *
184          * Rendering resolution of various browsers in px per inch:
185          * Windows Firefox and Internet Explorer:
186          *   SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
187          * Linux Firefox:
188          *   about:config *resolution: Default:96
189          *   (xorg screen dimension in mm and Desktop font dpi settings are ignored)
190          *
191          * Take care about extra font/image zoom factor of browser.
192          *
193          * In images, <img> size in pixel attribute, img css style, are overriding
194          * the real image dimension in px for rendering.
195          *
196          * @var int
197          */
198         "DOMPDF_DPI" => 96,
199
200         /**
201          * Enable inline PHP
202          *
203          * If this setting is set to true then DOMPDF will automatically evaluate
204          * inline PHP contained within <script type="text/php"> ... </script> tags.
205          *
206          * Enabling this for documents you do not trust (e.g. arbitrary remote html
207          * pages) is a security risk.  Set this option to false if you wish to process
208          * untrusted documents.
209          *
210          * @var bool
211          */
212         "DOMPDF_ENABLE_PHP" => false,
213
214         /**
215          * Enable inline Javascript
216          *
217          * If this setting is set to true then DOMPDF will automatically insert
218          * JavaScript code contained within <script type="text/javascript"> ... </script> tags.
219          *
220          * @var bool
221          */
222         "DOMPDF_ENABLE_JAVASCRIPT" => true,
223
224         /**
225          * Enable remote file access
226          *
227          * If this setting is set to true, DOMPDF will access remote sites for
228          * images and CSS files as required.
229          * This is required for part of test case www/test/image_variants.html through www/examples.php
230          *
231          * Attention!
232          * This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
233          * allowing remote access to dompdf.php or on allowing remote html code to be passed to
234          * $dompdf = new DOMPDF(, $dompdf->load_html(...,
235          * This allows anonymous users to download legally doubtful internet content which on
236          * tracing back appears to being downloaded by your server, or allows malicious php code
237          * in remote html pages to be executed by your server with your account privileges.
238          *
239          * @var bool
240          */
241         "DOMPDF_ENABLE_REMOTE" => true,
242
243         /**
244          * A ratio applied to the fonts height to be more like browsers' line height
245          */
246         "DOMPDF_FONT_HEIGHT_RATIO" => 1.1,
247
248         /**
249          * Enable CSS float
250          *
251          * Allows people to disabled CSS float support
252          * @var bool
253          */
254         "DOMPDF_ENABLE_CSS_FLOAT" => true,
255
256
257         /**
258          * Use the more-than-experimental HTML5 Lib parser
259          */
260         "DOMPDF_ENABLE_HTML5PARSER" => true,
261
262
263     ],
264
265
266 ];
Morty Proxy This is a proxified and sanitized view of the page, visit original site.