Saving pdf in background using html2pdf

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();
// convert to PDF
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($file_name.'_'.date("dmY").'.pdf');
    $html2pdf->Output($product_id.'_'.$file_name.'_'.date("dmY").'.pdf');
+5
source share
1 answer

script , , "background"...

PHP script ?

EDIT:

, , . . html2pdf-wiki. , !

$html2pdf->Output('directory/file_xxxx.pdf', 'F');
+12

All Articles