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