Online Readability Score Analyzer

Online Readability Score Analyzer

Enter Text to Analyze

${score}

${description}

`; } function clearResults() { resultsContainer.classList.add('hidden'); errorDisplay.classList.add('hidden'); } function showError(message) { errorDisplay.textContent = `Error: ${message}`; errorDisplay.classList.remove('hidden'); } // --- PDF DOWNLOAD --- function downloadPDF() { const options = { margin: [0.5, 0.5, 0.5, 0.5], filename: 'readability_analysis_report.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, logging: false }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' } }; // Clone the main container to add the original text to the PDF const contentToPrint = mainContainer.cloneNode(true); const originalTextDiv = document.createElement('div'); originalTextDiv.innerHTML = `

Original Text

${textInput.value}
`; // Find a suitable place to insert the text, e.g., before the results. const resultsNode = contentToPrint.querySelector('#results-container'); if(resultsNode) { resultsNode.parentNode.insertBefore(originalTextDiv, resultsNode); } html2pdf().from(contentToPrint).set(options).save(); } });
Scroll to Top