Jun 13, 2023
0
Level 1
How to Get Full Content using Tinymce getContent() API method
I have a form that uses tinymce and has content like the image above. Then, I want to preview that content to PDF page using getContent() API method with code like below.
<script nonce="{{ csp_nonce() }}">
var options = {
selector: "#body_sp3d",
menubar: 'file edit view insert format tools table help',
plugins: [
"advlist autolink autosave lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime nonbreaking save table directionality",
"template paste textpattern"
],
toolbar: "fullscreen restoredraft insertfile undo redo toc | styleselect fontselect fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify codesample | bullist numlist outdent indent toc",
};
tinymce.init(options);
</script>
<script>
$(document).ready(function() {
$('#previewSp3d').on('click', function() {
//get content from tinyMCE editor and set to #content_sp3d
var body_sp3d = tinymce.get('body_sp3d').getContent();
var no_sp3d = $('#no_sp3d').val();
var penerima_sp3d = $('#penerima_sp3d').val();
var klasifikasi_sp3d = $('#klasifikasi_sp3d').val();
var url = "{{ route('preview.sp3d')}}";
var full_url = url + '?no_sp3d=' + no_sp3d + '&penerima_sp3d=' + penerima_sp3d + '&body_sp3d=' + body_sp3d + '&klasifikasi_sp3d=' + klasifikasi_sp3d;
$('#previewSp3d').attr('href', full_url);
});
});
</script>
But, only part of the content is previewed, not all content can be displayed on the PDF page. How do I get all the content in the form to be displayed on the PDF page? Thanks
Please or to participate in this conversation.

