We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e201da commit bc4f060Copy full SHA for bc4f060
library/Pdfexport/ProvidedHook/Pdfexport.php
@@ -132,12 +132,15 @@ public function streamPdfFromHtml($html, $filename)
132
{
133
$filename = basename($filename, '.pdf') . '.pdf';
134
135
+ // Generate the PDF before changing the response headers to properly handle and display errors in the UI.
136
+ $pdf = $this->htmlToPdf($html);
137
+
138
/** @var Web $app */
139
$app = Icinga::app();
140
$app->getResponse()
141
->setHeader('Content-Type', 'application/pdf', true)
142
->setHeader('Content-Disposition', "inline; filename=\"$filename\"", true)
- ->setBody($this->htmlToPdf($html))
143
+ ->setBody($pdf)
144
->sendResponse();
145
146
exit;
0 commit comments