Examples

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

<link rel="stylesheet" href="/richtexteditor/rte_theme_default.css" />
<script type="text/javascript" src="/richtexteditor/rte.js"></script>
<script type="text/javascript" src='/richtexteditor/plugins/all_plugins.js'></script>
<div id="div_editor1" style="min-width:0; min-height:0; max-width:0; max-height:0; overflow: hidden;"></div>
<button class="btn btn-sm btn-primary transition-3d-hover" 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>