Smart Diagram Generator Smart Diagram Generator Turn your indented text into a professional diagram automatically. 1. Input 2. Design 3. Preview & Export Enter Your Data Use indentation (spaces or tabs) to define the hierarchy. Each new line is a new item. Customize Your Diagram Layout Direction Top to Down Left to Right Color Theme Preview & Export Download Diagram PDF Previous Next Generated on ${new Date("2025-09-11").toLocaleDateString()} ${diagramSvgElement.outerHTML} `; pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-report-container'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('Smart_Diagram.pdf'); } catch(e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download Diagram PDF'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } } downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- switchTab(0); renderThemeSelector(); });