Skip to content

Commit f49563a

Browse files
hasanwijayabarryvdhstevevg
authored
use own response for download (#22)
* change Content-Type to application/pdf barryvdh/laravel-dompdf@aac1b7e * add file size to browser download window barryvdh/laravel-dompdf@1056f54 Co-authored-by: Barry vd. Heuvel <[email protected]> Co-authored-by: stevevg <[email protected]>
1 parent 20111ef commit f49563a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/PDFMerger/PDFMerger.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Illuminate\Filesystem\Filesystem;
1818
use Illuminate\Support\Collection;
1919
use Illuminate\Support\Str;
20+
use Illuminate\Http\Response;
2021

2122
class PDFMerger {
2223

@@ -104,7 +105,12 @@ public function stream(){
104105
* @return string
105106
*/
106107
public function download(){
107-
return $this->oFPDI->Output($this->fileName, 'D');
108+
$output = $this->output();
109+
return new Response($output, 200, [
110+
'Content-Type' => 'application/pdf',
111+
'Content-Disposition' => 'attachment; filename="' . $this->fileName . '"',
112+
'Content-Length' => strlen($output),
113+
]);
108114
}
109115

110116
/**

0 commit comments

Comments
 (0)