Category: Laravel

* * @param array $config * @return void */ public function __construct(array $config = []) { parent::__construct($config['binary'], $config['generator']); } /** * Render the PDF preview.
* * @param \App\Invoice $invoice * @return string */ public function render(Invoice $invoice) { return $this->getOutputFromHtml( View::make('your.blade.template', compact('invoice'))->render() ); } }It’s very similar to the DOMPDF approach.
* * @return array */ public function provides() { return [Pdf::class]; } }Please note, since Laravel 5.8, the $defer property is deprecated.
* * @param \App\Services\Pdf $pdf * @return void */ public function __construct(Pdf $pdf) { $this->middleware('auth'); $this->pdf = $pdf; } /** * Generate the PDF to inspect or download.
* * @param \Illuminate\Http\Request $request * @param \App\Invoice $invoice * @return \Illuminate\Http\Response */ public function __invoke(Request $request, Invoice $invoice) { return response($this->pdf->render($invoice), 200)->withHeaders([ 'Content-Type' => 'application/pdf', 'Content-Disposition' => ($request->has('download') ?
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Community Partners