Online Smart Note-Taking with AI Insights

Smart Note-Taking with AI Insights

Write your notes, then click "Generate Insights" to get an AI-powered analysis.

My Notes

AI Insights

Your AI-generated summary, key points, and questions will appear here.

${data.summary}

`; insightsContent.appendChild(summaryEl); } if (data.keyPoints && data.keyPoints.length > 0) { const keyPointsEl = document.createElement('div'); const pointsList = data.keyPoints.map(point => `
  • ${point}
  • `).join(''); keyPointsEl.innerHTML = `

    Key Takeaways

      ${pointsList}
    `; insightsContent.appendChild(keyPointsEl); } if (data.questions && data.questions.length > 0) { const questionsEl = document.createElement('div'); const questionsList = data.questions.map(q => `
  • ${q}
  • `).join(''); questionsEl.innerHTML = `

    Follow-up Questions

      ${questionsList}
    `; insightsContent.appendChild(questionsEl); } } /** * Handles the PDF download functionality. */ function downloadPDF() { const { jsPDF } = window.jspdf; // Create a temporary clone for PDF generation to format it correctly const pdfClone = pdfContainer.cloneNode(true); pdfClone.style.position = 'absolute'; pdfClone.style.left = '-9999px'; pdfClone.style.width = '1200px'; // Set a fixed width for consistent rendering // Replace textarea with a div for clean PDF output const noteContentForPdf = pdfClone.querySelector('#note-editor'); const noteDiv = document.createElement('div'); noteDiv.className = noteContentForPdf.className; noteDiv.style.height = 'auto'; // Let height be automatic noteDiv.style.whiteSpace = 'pre-wrap'; // Preserve whitespace and newlines noteDiv.textContent = noteEditor.value; noteContentForPdf.parentNode.replaceChild(noteDiv, noteContentForPdf); document.body.appendChild(pdfClone); html2canvas(pdfClone, { scale: 2, useCORS: true }).then(canvas => { document.body.removeChild(pdfClone); // Clean up the clone 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 width = pdfWidth - 40; // with margin const height = width / ratio; pdf.addImage(imgData, 'PNG', 20, 20, width, height); pdf.save('Smart_Notes_with_AI_Insights.pdf'); }).catch(err => { document.body.removeChild(pdfClone); // Ensure cleanup on error console.error("Error generating PDF:", err); alert("Could not generate PDF. Please see the console for details."); }); } // --- EVENT LISTENERS --- generateBtn.addEventListener('click', handleGenerateInsights); downloadPdfBtn.addEventListener('click', downloadPDF); // --- INITIALIZATION --- // You can add sample text here if desired // noteEditor.value = `The First Amendment to the United States Constitution prevents the government from making laws that regulate an establishment of religion, prohibit the free exercise of religion, or abridge the freedom of speech, the freedom of the press, the right to peaceably assemble, or the right to petition the government for a redress of grievances.`; });
    Scroll to Top