Generate PDF from HTML?

Hello everyone!
Did anybody use a library to transform HTML to PDF?
I want to provide PDF files like bills for download for the user.
Working with light weight cromium takes us to permanently update the cromium.exe … maybe we are doing wrong here. Any other best practice around?
Thank you in advance,
br
HP

Hello,

jrxml template for the Reporting add-on has PDF output, it can be displayed on the screen, or programmatically e-mailed as an attachment. You can also save it to a filesystem, or to a Jmix file storage. So you can create your bills with a report, and then tell it what to do with it.
image

Kind regards,
Mladen

I am using com.openhtmltopdf.

InvoiceService.java

    /**
     * Generates a PDF for the provided invoice and saves it to a specified location.
     *
     * @param invoiceIO the Invoice object for which the PDF will be generated
     */
    public void generatePDF(Invoice invoiceIO) {
        if (invoiceIO != null && invoiceIO.getId() != null) {
            try (OutputStream outputIO = new FileOutputStream(getInvoicePath(invoiceIO))) {
                PdfRendererBuilder builderIO = new PdfRendererBuilder();
                builderIO.withUri(getInvoicePath(invoiceIO));
                builderIO.toStream(outputIO);
                builderIO.withHtmlContent(generateContent(invoiceIO), null);
                builderIO.run();

                logger.debug("Generated Invoice PDF: " + getInvoicePath(invoiceIO) + " successfully.");
            } catch (Exception exceptionIO) {
                throw new RuntimeException(exceptionIO);
            }
        }
    }

The Template is compiled via freeMarker.