Type Sinhala or English notes. Use $...$ for inline math, $$...$$ for display math, and logical symbols like $\overline{X}$ for X̅ (X bar).
Your formatted math and Sinhala text will appear here...
| /g, ' | ') .replace(/ | /g, ' | ');pdfContainer.innerHTML = `Student Math NotesGenerated on ${new Date().toLocaleDateString()} ${content}
`;
document.body.appendChild(pdfContainer);// Use html2canvas with simple configuration
const canvas = await html2canvas(pdfContainer, {
scale: 2,
useCORS: true,
logging: false,
backgroundColor: '#ffffff',
width: pdfContainer.scrollWidth,
height: pdfContainer.scrollHeight
});const imgData = canvas.toDataURL('image/png');
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = pdf.internal.pageSize.getHeight();
// Calculate image dimensions to fit PDF
const imgWidth = pdfWidth;
const imgHeight = (canvas.height * pdfWidth) / canvas.width;
// Add image to PDF
pdf.addImage(imgData, 'PNG', 0, 0, imgWidth, imgHeight);
// Clean up
document.body.removeChild(pdfContainer);
// Save PDF
pdf.save('Student_Math_Note.pdf');
} catch (error) {
console.error('PDF generation error:', error);
alert('Error generating PDF. Please try again with simpler content.');
}
}// ✅ FIXED WORD EXPORT - Simplified and reliable
function downloadWord() {
let content = tinyMCEEditor.getContent();
// Convert MathJax to Unicode
content = content
.replace(/\\overline\{X\}/g, 'X̅')
.replace(/\\overline\{A\}/g, 'A̅')
.replace(/\\overline\{B\}/g, 'B̅')
.replace(/\\overline\{([^}]*)\}/g, '$1̅')
.replace(/\\cdot/g, '·')
.replace(/\$\$\\overline\{([^}]*)\}\$\$/g, '$1̅')
.replace(/\$\\overline\{([^}]*)\}\$/g, '$1̅')
.replace(/\$\$(.*?)\$\$/g, '$1')
.replace(/\$(.*?)\$/g, '$1')
.replace(/📗|🧩|🧮|📘|📏|📊|🔄|🧹|➕|📄|🧾|📋|🔌|📚|💾|📂|🖨️/g, '')
.replace(/
|
|---|