I have a problem with dompdf. I'm trying to generate a PDF file through the values of a form. A user enters the website, fills out the fields and clicks submit. In my email I must attach a PDF with all the form values. I was able to integrate it into my code, but there is something wrong. To submit, I get the mail with the PDF, but it is damaged. (Of 0BYTE.)
The code I've entered in includes / ajax.php. This is the code:
// Generate PDF here
require_once("../dompdf/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
$dompdf = new DOMPDF();
$dompdf->load_html($message);
$dompdf->render();
$pdf_content = $dompdf->output();
file_put_contents('../dompdf/ordine.pdf',$pdfoutput);
data users write in the form are in $message
this is my ajax.php
Try this
// Generate PDF here
require_once("../dompdf/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
$dompdf = new DOMPDF();
$dompdf->load_html($message);
$dompdf->render();
$pdf_content = $dompdf->output();
file_put_contents('../dompdf/ordine.pdf',$pdf_content); //there was a typo here...
You pdf was correctly 0 bytes because you write an undefined variable to it.