![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/pdf-ai.com/public_html/public/js/ |
function exportWord(){
var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' "+
"xmlns:w='urn:schemas-microsoft-com:office:word' "+
"xmlns='http://www.w3.org/TR/REC-html40'>"+
"<head><meta charset='utf-8'><title>Export HTML to Word Document with JavaScript</title></head><body>";
var footer = "</body></html>";
var id = document.querySelector('.richText-editor').id
var sourceHTML = header+document.getElementById(id).innerHTML+footer;
var source = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(sourceHTML);
var fileDownload = document.createElement("a");
document.body.appendChild(fileDownload);
fileDownload.href = source;
fileDownload.download = 'document.doc';
fileDownload.click();
document.body.removeChild(fileDownload);
toastr.success('Word document was created successfully');
}
function exportPDF(){
window.jsPDF = window.jspdf.jsPDF;
var doc = new jsPDF();
var id = document.querySelector('.richText-editor').id;
console.log(id)
var elementHTML = document.querySelector('#' + id);
doc.html(elementHTML, {
callback: function(doc) {
doc.save('document.pdf');
},
x: 15,
y: 15,
width: 170, //target width in the PDF document
windowWidth: 650 //window width in CSS pixels
});
toastr.success('PDF file was created successfully');
}
function copyText() {
var r = document.createRange();
var id2 = document.querySelector('.richText-editor').id;
r.selectNode(document.getElementById(id2));
window.getSelection().removeAllRanges();
window.getSelection().addRange(r);
document.execCommand('copy');
window.getSelection().removeAllRanges();
toastr.success('Result text has been copied successfully');
}