Search the Community
Showing results for tags 'temp file'.
Hi, I wan't to send a generated PDF with in an email attachment. To sent the email, I have to generate and save the PDF file. I' don't need it afterwards, zo I want to remove the generated PDF after some time. In the documentation i found there's a tempDir() method, but I can't get it to work. I use the dompdf library to generate a PDF This is my current test code: $dompdf = new Dompdf(); $dompdf->loadHtml('hello world'); // (Optional) Setup the paper size and orientation $dompdf->setPaper('A4', 'landscape'); // Render the HTML as PDF $dompdf->render(); $wireTempDir = files()->tempDir('test'); $output = $dompdf->output('test.pdf'); file_put_contents($wireTempDir, $output);