Saving pdf in the background using html2pdf -


am tryng automatically generate pdfs using html2pdf class. got following code working fine, has save pdf manually. however, whenever new product added, automatically save pdf folder without user intervention, , store value in database future reference. how go saving pdf 'silently' i.e. in background without showing popups or requiring user intervene? in advance.

 include('pdf_content.php');  $content = ob_get_clean(); // convert 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'); 

you can try calling script everytime new product added, although wouldn't in "background"...

for more information, please note question "how can run php script in background after form submitted?"

edit:

if wish save file on server instead of outputting browser, can use different parameters. see html2pdf-wiki. aware cannot save file on user's computer unnoticed!

$html2pdf->output('directory/file_xxxx.pdf', 'f'); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -