1. Go to this page and download the library: Download sahifa/laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sahifa / laravel example snippets
use Sahifa\Laravel\Facades\Sahifa;
return Sahifa::pdfFromView('invoices.show', ['invoice' => $invoice])->download('invoice.pdf');
$pdf = Sahifa::pdfFromView('invoices.show', ['invoice' => $invoice], [
'format' => 'A4',
'margin' => '15mm',
'footer' => ['source' => '<div style="width:100%;text-align:center;font-size:9px">صفحة {{page}} من {{total}}</div>'],
]);
return $pdf->download("invoice-{$invoice->number}.pdf"); // or ->inline()
$pdf->store("invoices/{$invoice->number}.pdf", 's3'); // any filesystem disk
$pdf->save(storage_path('app/invoice.pdf')); // local path
$bytes = $pdf->content(); // raw bytes, e.g. for a Mailable attachment