Text Consistency Checker

Text Consistency Checker

Analyze your text for inconsistencies in spelling, capitalization, and more.

No common inconsistencies were found in your text.

`; } html += `
`; analysisResultsEl.innerHTML = html; } // --- PDF Generation --- async function generatePdf() { if (!consistencyData) { alert("Please analyze text before downloading a report."); return; } const pdfBtn = document.getElementById('pdf-btn'); if(!pdfBtn) return; pdfBtn.textContent = 'Generating...'; pdfBtn.disabled = true; try { let reportHTML = `

Text Consistency Report

`; // Spelling section reportHTML += `

Spelling Inconsistencies

`; if (consistencyData.spelling.length > 0) { reportHTML += ``; consistencyData.spelling.forEach(item => { reportHTML += ``; }); reportHTML += `
Term 1 (Count)Term 2 (Count)
${item.term1} (x${item.count1})${item.term2} (x${item.count2})
`; } else { reportHTML += `

No spelling inconsistencies found.

`; } // Capitalization section reportHTML += `

Capitalization Inconsistencies

`; if (consistencyData.capitalization.length > 0) { reportHTML += ``; consistencyData.capitalization.forEach(item => { reportHTML += ``; }); reportHTML += `
WordVariations Found
${item.word}${item.cases.join(', ')}
`; } else { reportHTML += `

No capitalization inconsistencies found.

`; } reportHTML += `

Original Text

${textInput.value}

`; pdfContentEl.innerHTML = reportHTML; pdfContentEl.style.display = 'block'; const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfContentEl, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF('p', 'mm', 'a4'); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('text-consistency-report.pdf'); } catch (error) { console.error('PDF Generation Error:', error); alert('An error occurred while creating the PDF.'); } finally { pdfContentEl.style.display = 'none'; pdfContentEl.innerHTML = ''; pdfBtn.textContent = 'Download Report'; pdfBtn.disabled = false; } } });
Scroll to Top