diff --git a/src/Wrapper/DompdfWrapper.php b/src/Wrapper/DompdfWrapper.php index 00b4923..abcedd7 100644 --- a/src/Wrapper/DompdfWrapper.php +++ b/src/Wrapper/DompdfWrapper.php @@ -40,13 +40,13 @@ public function streamHtml(string $html, string $filename, array $options = []): { $pdf = $this->dompdfFactory->create($options); $pdf->loadHtml($html); - $pdf->render(); if ($this->eventDispatcher instanceof EventDispatcherInterface) { $event = new StreamEvent($pdf, $filename, $html); $this->eventDispatcher->dispatch($event, DompdfEvents::STREAM); } + $pdf->render(); $pdf->stream($filename, $options); } @@ -54,13 +54,13 @@ public function getPdf(string $html, array $options = []): string { $pdf = $this->dompdfFactory->create($options); $pdf->loadHtml($html); - $pdf->render(); if ($this->eventDispatcher instanceof EventDispatcherInterface) { $event = new OutputEvent($pdf, $html); $this->eventDispatcher->dispatch($event, DompdfEvents::OUTPUT); } + $pdf->render(); $out = $pdf->output(); if (null === $out) {