jisona.co.in

Best Free Online Notepad Tool | Image Insert + Font Control + PDF Download

Online Notepad — Free, Mobile Friendly, PDF / TXT / DOC Export

Online Notepad — Type title here (This will be used as SEO title)

Tip: Title should be short and clear — it will appear at the top and used for PDF file name.

Words: 0 • Characters: 0

Notes: Content auto-saves in your browser (Local Storage). You can edit the page title at the top — it will be used as the filename when downloading PDF/DOC/TXT.

'; const filename = sanitizeFilename(pageTitle.innerText||'note') + '.doc'; const blob = new Blob([html], {type:'application/msword'}); triggerDownload(blob, filename); });// Export: PDF using html2pdf document.getElementById('downloadPdf').addEventListener('click', async ()=>{ // clone editor so we can style for PDF const clone = editor.cloneNode(true); const wrapper = document.createElement('div'); const titleEl = document.createElement('h2'); titleEl.innerText = pageTitle.innerText || 'Note'; wrapper.appendChild(titleEl); wrapper.appendChild(clone); const opt = { margin: 10, filename: sanitizeFilename(pageTitle.innerText||'note') + '.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true }, jsPDF: { unit: 'pt', format: 'a4', orientation: 'portrait' } }; html2pdf().set(opt).from(wrapper).save(); });// helpers function triggerDownload(blob, filename){ const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); a.remove(); URL.revokeObjectURL(url); } function sanitizeFilename(name){ return name.replace(/[^a-z0-9\-_\. ]/ig,'').trim() || 'note'; } function escapeHtml(text){ return text.replace(/&/g,'&').replace(//g,'>'); }// Counts const counts = document.getElementById('counts'); function updateCounts(){ const txt = editor.innerText || ''; const words = txt.trim() ? txt.trim().split(/\s+/).length : 0; const chars = txt.length; counts.innerText = `Words: ${words} • Characters: ${chars}`; } editor.addEventListener('input', updateCounts); updateCounts();// Utility: download via a tag// On load, ensure contenteditable blank placeholder if(!editor.innerHTML) editor.innerHTML = '


';// Make editor width responsive (mobile 90%) and initial height half viewport (function applyResponsive(){ const el = document.querySelector('.card'); function setSizes(){ const vw = Math.max(document.documentElement.clientWidth || 320); if(vw <= 700){ el.style.margin = '10px'; el.style.width = 'calc(100% - 20px)'; } else { el.style.width = '100%'; } // editor height half viewport const ed = document.querySelector('.editor'); ed.style.minHeight = (window.innerHeight * 0.5) + 'px'; } setSizes(); window.addEventListener('resize', setSizes); })();// Save when leaving window.addEventListener('beforeunload', ()=>{ localStorage.setItem(COUNTER_KEY, editor.innerHTML); localStorage.setItem(TITLE_KEY, pageTitle.innerText);} );// Accessibility: keyboard shortcuts document.addEventListener('keydown',(e)=>{ if(e.ctrlKey && e.key==='s'){ e.preventDefault(); document.getElementById('downloadPdf').click(); } });