Hi @Kovah , I’m working in an improvement for IP. It consists in a new report that allow to group invoices filtering by dates. The idea is that it generates one PDF with all the invoices.
It would be great if you asign me a ticket and I will upload it to GitHub when it will be ready.
Hi @Kovah, I have been working on that improvement and I achieved that functionality but I think that I’m not doing the procediment in the best way.
I have some doubts:
How can I generate a PDF of an invoice without open it into a new URL in the browser? I have found a function called generate_pdf in invoices.php but I don’t know how can I use it directly in PHP.
When I generate PDF of some invoices, those PDFs are encrypted, so I need to uncrypt it. How can I uncrypt with the mCrypt library o how can I generate PDF without encryption?
You can generate PDFs by opening the correct URL: yourdomain.com/invoices/generate_pdf/32513 where 32513 would be the internal ID of the invoice, not the invoice number.
PDFs should not be encrypted by default. Please make sure that you do not have a default password set in the settings.
I know that I can generate a PDF invoice by going to an URL but, is there not other way to generate it directly from php?
At the moment I’m doing it like that:
echo “< script language=“javascript”> myWindow = window.open(”’ . $location . '","_blank"); myWindow.close();< /script>";
But the fact is that for that functionallity, is normal to generate a lot of invoices (it should be a period about 3-4 months generally). So, the code open a lot of tabs and then it closes it. I don’t really like that way for my purpose.
When I generate invoices in that way, I get some PDF but when I try to merge it into only one, there is an error telling me that the PDFs are encrypted. I have checked it and I don’t have any password set in my setting by default.