Note-Taking Chatbot

Note-Taking Chatbot

${note.content}

` ).join(''); } else { pdfPreviewContent.innerHTML = '

No notes to preview.

'; } }; downloadPdfButton.addEventListener('click', () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const margin = 20; const pageWidth = doc.internal.pageSize.getWidth(); let y = margin; doc.setFont('helvetica', 'bold'); doc.setFontSize(22); doc.text('Notes Report', pageWidth / 2, y, { align: 'center' }); y += 8; doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor('#6B7280'); doc.text(`Generated on: ${new Date().toLocaleDateString('en-US')}`, pageWidth / 2, y, { align: 'center' }); y += 15; if (notes.length > 0) { notes.forEach((note, index) => { if (y > doc.internal.pageSize.getHeight() - margin * 2) { doc.addPage(); y = margin; } doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.setTextColor('#374151'); doc.text(`Note #${index + 1}`, margin, y); y += 7; doc.setFont('helvetica', 'normal'); doc.setFontSize(11); doc.setTextColor('#4B5563'); const splitText = doc.splitTextToSize(note.content, pageWidth - margin * 2); doc.text(splitText, margin, y); y += (splitText.length * 5) + 8; if (index < notes.length - 1) { doc.setDrawColor('#E5E7EB').line(margin, y, pageWidth - margin, y); y += 8; } }); } else { doc.setFontSize(12).setTextColor('#4B5563'); doc.text('No notes were saved.', pageWidth / 2, y, { align: 'center' }); } doc.save('Chatbot-Notes-Report.pdf'); }); // --- Initial Setup --- addMessage("Hello! I'm ready to take notes. Start your message with 'note:', 'save:', or 'remember:'.", 'bot'); showTab(0); });
Scroll to Top