Report Writing Assistant

Report Writing Assistant

Structure and generate professional reports step-by-step.

Report Title and Introduction

${reportData.conclusion.replace(/\n/g, '
') || '...'}

`; previewContent.innerHTML = html; } // --- PDF DOWNLOAD LOGIC --- downloadPdfBtn.addEventListener('click', () => { const { jsPDF } = window.jspdf; const content = document.getElementById('report-preview-content'); html2canvas(content, { scale: 2, backgroundColor: '#ffffff' }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; const widthInPdf = pdfWidth - 80; // Margin const heightInPdf = widthInPdf / ratio; let position = 40; pdf.addImage(imgData, 'PNG', 40, position, widthInPdf, heightInPdf); let heightLeft = heightInPdf - (pdfHeight - 80); while (heightLeft > 0) { position = position - (pdfHeight - 80); pdf.addPage(); pdf.addImage(imgData, 'PNG', 40, position, widthInPdf, heightInPdf); heightLeft -= (pdfHeight - 80); } const fileName = (reportData.title || 'report').replace(/\s/g, '-') + '.pdf'; pdf.save(fileName); }); }); // --- INITIALIZATION --- renderBodySections(); lucide.createIcons(); });
Scroll to Top