Hi, I follow the example from the documentation page:
$pdfGenerator = new PdfGenerator(); //Set absolute path of the Twig layout $pdfGenerator->layout = plugins_path().'/initbiz/pdfGenerator/pdflayouts/example/default.htm'; //Set filename for downloaded file $pdfGenerator->filename = "invoice"; //Set data which will be sent to the layout $pdfGenerator->data = ['viewData' => 'Value of viewData']; $pdfGenerator->generatePdf(); return $pdfGenerator->downloadPdf();
and the PDF is created in the correct directory. However, the filename is something like
generated_W4yPGQH1rDIrk2Q.pdf
although I have set it to invoice.
Also, I get redirected to the following page /initbiz/pdfgenerator/download/invoice/W4yPGQH1rDIrk2Q With the exception being The file "/Applications/MAMP/htdocs/XXX/pdfs/invoice_W4yPGQH1rDIrk2Q.pdf" does not exist
I will look into the code and change the filename there manually but can you tell me what I did wrong/is this a bug?
Kind regards
Last updated