I need some advise with the following use case:
We have a custom object "Invoice" and want to generate the Invoice PDF using a JavaScript Library that is able to convert an HTML Code of the Invoice Document into a PDF.
In another custom object called "Document Template" we store the full HTML code similar to this one:
https://github.com/anvilco/html-pdf-invoice-template
The HTML Code in the Document Template Object is prepared for Visualforce and contains the logic to populate the fields from the Invoice record and it's related line items.
So far we are able to pass this in a way to have a proper looking Visualforce Page as in above sample.
Now our idea was to use the VF generated HTML Code and pass it to any PDF-JavaScript Library to get it rendered as a PDF and save it to the ContentDocument Object.
So far we tried with JSPDF but actually we don't understand if thats really possible how we imagine and we have not been able to find any similar solution. We made it work to pass single text strings or something to get it rendered as a PDF but we are not able to pass the whole HTML Code.
So I am asking for some advise to understand if someone else had such a use case already, knows some documentation on it or has some better idea on how to get this done WITHOUT any external API services that renders the PDF based on the HTML Code?
The issue with renderas=PDF and blob.toPDF is that it is not supporting custom fonts.
Thanks for your help.