Hallo,
I'm trying to find the best way to generate PDF from the invoice to make it quite faithful to the original html. What are you using?
Tanks.
Hello,
There are multiple ways to do that. You could use a PHP library to do that on the backend or you can use JsPDF for front-end processing.
Interesting jsPDF project. But does anyone know any project that converts a standard HTML to PDF, passing a URL
I usually use wkhtmltopdf for this. It's a binary you'd have to install and then call it in your backend. On windows it is somehow hard to configure and the setup using arbitrary fonts is somehow complicated but the results are good.
One note, if you're about to use it, make sure that all assets are included using their absolute paths (especially CSS) in your HTML file as otherwise the result might look weird / unstyled at all.
Will can not use the wkhtmltopdf on a .Net server?
To me wkhtmltopdf doesn't seem to work well to generate pdf from invoices.
@mtsys as it is a binary you can call it from whatever environment you want
@AndrewLag I have no problems ... sometimes the rendering of multi page tables is weird (repeating table header overlaps first row if you don't use proper CSS rules), but as the wkhtmltopdf uses a patched QT and an headless browser (webkit) to generate the PDF almost all CSS rules apply and look good. Of course it will respect the media settings for CSS (so if your CSS is included via media=screen the result won't be looking good.. )
:+1: for the JsPDF tip
I have used html2pdf.it for a while and love it! No need to install a thing. All you do is make a url with a query string like http://html2pdf.it/?url=http://google.com.