diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index d726225f0c..80b5a4dd0f 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -241,6 +241,11 @@ class SetupController extends Controller $pdf->setChromiumPath(config('ninja.snappdf_chromium_path')); } + if (config('ninja.snappdf_chromium_arguments')) { + $pdf->clearChromiumArguments(); + $pdf->addChromiumArguments(config('ninja.snappdf_chromium_arguments')); + } + $pdf = $pdf ->setHtml('GENERATING PDFs WORKS! Thank you for using Invoice Ninja!') ->generate(); diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index ace23993a1..41c5d82a9c 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -34,6 +34,11 @@ trait PdfMaker $pdf->setChromiumPath(config('ninja.snappdf_chromium_path')); } + if (config('ninja.snappdf_chromium_arguments')) { + $pdf->clearChromiumArguments(); + $pdf->addChromiumArguments(config('ninja.snappdf_chromium_arguments')); + } + $generated = $pdf ->setHtml($html) ->generate(); diff --git a/config/ninja.php b/config/ninja.php index 12e9acec68..58c1c0ec8f 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -142,6 +142,7 @@ return [ 'log_pdf_html' => env('LOG_PDF_HTML', false), 'expanded_logging' => env('EXPANDED_LOGGING', false), 'snappdf_chromium_path' => env('SNAPPDF_CHROMIUM_PATH', false), + 'snappdf_chromium_arguments' => env('SNAPPDF_CHROMIUM_ARGUMENTS', false), 'v4_migration_version' => '4.5.35', 'flutter_renderer' => env('FLUTTER_RENDERER', 'selfhosted-html'), 'webcron_secret' => env('WEBCRON_SECRET', false), diff --git a/tests/Pdf/PdfGenerationTest.php b/tests/Pdf/PdfGenerationTest.php index 51d6e4360b..41d9f0a645 100644 --- a/tests/Pdf/PdfGenerationTest.php +++ b/tests/Pdf/PdfGenerationTest.php @@ -34,6 +34,11 @@ class PdfGenerationTest extends TestCase $pdf->setChromiumPath(config('ninja.snappdf_chromium_path')); } + if (config('ninja.snappdf_chromium_arguments')) { + $pdf->clearChromiumArguments(); + $pdf->addChromiumArguments(config('ninja.snappdf_chromium_arguments')); + } + $pdf = $pdf ->setHtml('