18 lines
382 B
PHP
18 lines
382 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Dompdf\Dompdf;
|
|
|
|
class PdfGenerateAndDownloadProvider {
|
|
public static function fromHtml(string $html, string $orientation = 'portrait'): string
|
|
{
|
|
$dompdf = new Dompdf();
|
|
$dompdf->loadHtml($html, 'UTF-8');
|
|
$dompdf->setPaper('A4', $orientation);
|
|
$dompdf->render();
|
|
|
|
return $dompdf->output();
|
|
}
|
|
}
|