Skip to content

Commit

Permalink
Added download example for the Laravel examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ruff committed Sep 18, 2023
1 parent 838cd50 commit c945d53
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,22 @@ class ZugferdController extends Controller

return $visualizer->renderMarkup();
}

public function download(Request $request)
{
$document = ZugferdDocumentReader::readAndGuessFromFile(storage_path('app/invoice_1.xml'));

$visualizer = new ZugferdVisualizer($document);
$visualizer->setDefaultTemplate();
$visualizer->setPdfFontDefault("courier");
$visualizer->setPdfPaperSize('A4-P');
$visualizer->renderPdfFile(storage_path('app/invoice_1.pdf'));

$headers = [
'Content-Type: application/pdf',
];

return response()->download(storage_path('app/invoice_1.pdf'), "invoice_1.pdf", $headers);
}
}
```

0 comments on commit c945d53

Please sign in to comment.