Abstract Generator
Construct a clear and concise academic abstract.
Your complete abstract will be generated here.
Word Count: 0
${abstractText || 'Please fill in the previous sections to generate the abstract.'}
`; document.getElementById('generated-abstract-content').innerHTML = html; wordCountEl.textContent = `Word Count: ${wordCount}`; }; const downloadPdf = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' }); const data = getAbstractData(); const abstractText = joinSentences(data.background, data.purpose, data.methods, data.results, data.conclusion); const pageW = doc.internal.pageSize.getWidth(); const margin = 25; let y = margin + 10; doc.setFont('times', 'bold').setFontSize(14).text(data.title, pageW / 2, y, { align: 'center', maxWidth: pageW - margin * 2 }); y += 10; if(data.field){ doc.setFont('times', 'normal').setFontSize(12).text(data.field, pageW / 2, y, { align: 'center' }); y += 15; } doc.setFont('times', 'bold').setFontSize(12).text('Abstract', margin, y); y += 8; const lines = doc.setFont('times', 'normal').setFontSize(12).splitTextToSize(abstractText, pageW - margin * 2); doc.text(lines, margin, y, { lineHeightFactor: 1.5 }); y += (lines.length * 12 * 0.5) + 10; const wordCount = abstractText.split(/\s+/).filter(word => word.length > 0).length; doc.setFont('times', 'italic').setFontSize(10).text(`Word Count: ${wordCount}`, margin, y); doc.save(`${data.title.replace(/\s+/g, '-')}-Abstract.pdf`); }; downloadPdfBtn.addEventListener('click', downloadPdf); // Initialize updateTabUI(0); lucide.createIcons(); });