From 3fabaa2e5b5bf86f72742ace7861026135d87eb8 Mon Sep 17 00:00:00 2001 From: cesarreyes3 <109559100+cesarreyes3@users.noreply.github.com> Date: Fri, 15 Mar 2024 09:46:05 -0500 Subject: [PATCH] Fix setOptions (#1040) --- src/PDF.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PDF.php b/src/PDF.php index 2b68b94..0378fee 100644 --- a/src/PDF.php +++ b/src/PDF.php @@ -156,13 +156,15 @@ public function setOption($attribute, $value = null): self /** * Replace all the Options from DomPDF * - * @deprecated Use setOption to override individual options. * @param array $options */ - public function setOptions(array $options): self + public function setOptions(array $options, bool $mergeWithDefaults = false): self { - $options = new Options($options); - $this->dompdf->setOptions($options); + if ($mergeWithDefaults) { + $options = array_merge(app()->make('dompdf.options'), $options); + } + + $this->dompdf->setOptions(new Options($options)); return $this; }