Created
October 18, 2023 20:54
-
-
Save juanchehin/4490219009fdb2532737b0a990eea49c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function crear_factura_pdf() | |
{ | |
$dompdf = new Dompdf(); | |
$html_dir =__DIR__ . '/factura.html'; | |
$html = file_get_contents($html_dir); | |
print_r($html_dir); | |
if ($html === false) { | |
print_r(error_get_last()['message']); | |
exit; | |
// echo "Se produjo un error al leer el archivo: " . error_get_last()['message']; | |
} else { | |
// El archivo se leyó correctamente | |
} | |
// Cargar el HTML | |
$dompdf->loadHtml($html); | |
// Definir las opciones de configuración | |
$dompdf->setPaper('A3'); | |
// $dompdf->setFont('Helvetica', '', 12); | |
// Crear el PDF | |
$dompdf->render(); | |
// Descargar el PDF | |
$dompdf->stream(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment