X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/756b55bbffedb6e5fde91f9fbc61f5a382f20705..refs/pull/4467/head:/app/Config/dompdf.php diff --git a/app/Config/dompdf.php b/app/Config/dompdf.php index cf07312e8..09dd91bcc 100644 --- a/app/Config/dompdf.php +++ b/app/Config/dompdf.php @@ -8,11 +8,16 @@ * Do not edit this file unless you're happy to maintain any changes yourself. */ +$dompdfPaperSizeMap = [ + 'a4' => 'a4', + 'letter' => 'letter', +]; + return [ 'show_warnings' => false, // Throw an Exception on warnings from dompdf - 'orientation' => 'portrait', - 'defines' => [ + + 'options' => [ /** * The location of the DOMPDF font directory. * @@ -70,18 +75,28 @@ return [ * direct class use like: * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); */ - 'chroot' => realpath(base_path()), + 'chroot' => realpath(public_path()), /** - * Whether to use Unicode fonts or not. + * Protocol whitelist. * - * When set to true the PDF backend must be set to "CPDF" and fonts must be - * loaded via load_font.php. + * Protocols and PHP wrappers allowed in URIs, and the validation rules + * that determine if a resouce may be loaded. Full support is not guaranteed + * for the protocols/wrappers specified + * by this array. * - * When enabled, dompdf can support all Unicode glyphs. Any glyphs used in a - * document must be present in your fonts, however. + * @var array */ - 'unicode_enabled' => true, + 'allowed_protocols' => [ + 'file://' => ['rules' => []], + 'http://' => ['rules' => []], + 'https://' => ['rules' => []], + ], + + /** + * @var string + */ + 'log_output_file' => null, /** * Whether to enable font subsetting or not. @@ -150,7 +165,16 @@ return [ * * @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.) */ - 'default_paper_size' => 'a4', + 'default_paper_size' => $dompdfPaperSizeMap[env('EXPORT_PAGE_SIZE', 'a4')] ?? 'a4', + + /** + * The default paper orientation. + * + * The orientation of the page (portrait or landscape). + * + * @var string + */ + 'default_paper_orientation' => 'portrait', /** * The default font family. @@ -254,10 +278,13 @@ return [ 'enable_css_float' => true, /** - * Use the more-than-experimental HTML5 Lib parser. + * Use the HTML5 Lib parser. + * + * @deprecated This feature is now always on in dompdf 2.x + * + * @var bool */ - 'enable_html5parser' => true, - + 'enable_html5_parser' => true, ], ];