laravel-pdfmerger
laravel-pdfmerger copied to clipboard
fixes no response being send on download
After updating to version 1.3.1, no file download response was triggered when calling the download function, which may result in empty pdf files #31.
This is due to the new use of the "Illuminate\Http\Response" class inside of the download
method.
$output = $this->output();
return new Response($output, 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="' . $this->fileName . '"',
'Content-Length' => strlen($output),
]);
The reason for the problem is that the response is generated and returned but not sent. To do this, we have to call the send
method of the response class.
$output = $this->output();
$response = new Response($output, 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="' . $this->fileName . '"',
'Content-Length' => strlen($output),
]);
return $response->send();
This solves the problem! (tested on laravel 9)
Hi @Webklex , can we merge this?
I got the problem this commit fixes ! Empty blank page when I tried to use the download() method. Thanks a lot for this fix, hope it gets merged soon
Hi @KreutzerCode , many thanks for your time and effort to improve this library :)
Best regards & happy coding,