Dynamic PDF Creation

This example shows how RichTextEditor can generate standards-based PDF output on the fly. In this sample, a hidden editor instance is used to convert HTML into a PDF file.

Example code

<div id="div_editor1" style="min-width:0; min-height:0; max-width:0; max-height:0; overflow: hidden;"></div>
<button class="ls-cta" onclick="downloadPDFDialog()">
    Open generated PDF
</button>

<script>
    var editor1cfg = {}
    var editor1 = new RichTextEditor("#div_editor1", editor1cfg);

    function downloadPDFDialog() {
        editor1.setHTMLCode("<p>Hello World</p>")
        editor1.execCommand("html2pdf");
    }
</script>