Try to automatically generate PDF files using the html2pdf class. I got the following code that works fine, just so that someone needs to save the PDF manually. However, whenever a new product is added, I would like to automatically save the pdf file to a folder without user intervention and save this value in the database for future use. How can I save pdf "quietly", i.e. In the background, without showing pop-ups or without requiring user intervention? Thanks in advance.
include('pdf_content.php');
$content = ob_get_clean();
require_once('html2pdf/html2pdf.class.php');
try
{
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output($product_id.'_'.$file_name.'_'.date("dmY").'.pdf');
source
share