I need to generate a PDF at the end of filling out a form and then attach it and send it via email. I need a light because I have no idea what tools to use!
Thank you very much for your attention.
I need to generate a PDF at the end of filling out a form and then attach it and send it via email. I need a light because I have no idea what tools to use!
Thank you very much for your attention.
After the POST of the form, put a "body" in HTML itself (you do not need to display it. Save to a variable), and make the PDF lib of your choice convert into a valid PDF.
I personally use mPDF for this and solve 95% of my problems (I had a recent problem with large tables and still could not heal In fact, it's perfect and super flexible.)
After that, I write the PDF to the server. In the case of MPDF, I use:
$mpdf->Output($_SERVER['DOCUMENT_ROOT'].'/upload/pdf/'.$nomeArquivo.'.pdf', 'F');
Once it's saved, I'll take the URL I generated there and use PHPMailer to send the attached file. To attach something with PHPMailer, I use:
$mail->AddAttachment($_SERVER['DOCUMENT_ROOT'].'/upload/pdf/'.$nomeArquivo.'.pdf);