setPaper('A4',$j['paper']); $pdf->setOption(['dpi' => $j['dpi'], ]); $pdf->loadHTML($html); $path = "$path.pdf"; Storage::delete($path); Storage::put($path, $pdf->output()); } function html_create($path, $html, $paper="portrait") { $path = "$path.html"; Storage::delete($path); Storage::put($path, $html); $htmlPath = "storage/documents/" . $path; $pdfPath = str_replace(".html", ".pdf", $htmlPath); html_to_pdf($htmlPath, $pdfPath, $paper); unlink($htmlPath); } ?>