Text to PDF

Convert text to downloadable PDF documents.

'+escapeHtml(text)+' '; win.document.write(content); win.document.close(); setTimeout(function(){win.print(); },500); document.getElementById('pdf-info').textContent='PDF preview opened. Use browser print dialog to save as PDF.'; }; window.printPDF=function(){ var text=document.getElementById('pdf-input').value; if(!text)return; var size=document.getElementById('pdf-fontsize').value; var font=document.getElementById('pdf-font').value; var iframe=document.createElement('iframe'); iframe.style.display='none'; document.body.appendChild(iframe); var doc=iframe.contentDocument; doc.open(); doc.write(' '+escapeHtml(text)+' '); doc.close(); setTimeout(function(){iframe.contentWindow.print(); setTimeout(function(){document.body.removeChild(iframe); },1000); },500); }; function escapeHtml(t){var d=document.createElement('div');d.appendChild(document.createTextNode(t));return d.innerHTML; } })();