Abstract Concept Map Generator

Abstract Concept Map Generator

Your Concept Map

This is your generated map. You can drag nodes, zoom, and pan to explore the connections.

Configure Your Concepts

Enter one relationship per line.
The first item on the line is the main concept, and all other items are related concepts it links to.
Format: Main Concept, Related Concept 1, Related Concept 2

An error occurred while generating the map. Please check your data format.

`; } } // --- PDF Download Function --- function downloadPDF() { if (!checkLibraries()) { alert('Error: PDF generation libraries are not loaded.'); return; } if (network === null) { alert('Please generate a map first before downloading.'); return; } // Get the main visualization const captureElement = graphContainer.querySelector('canvas'); if (!captureElement) { alert('Error: Could not find map canvas to capture.'); return; } // Show a temporary message const originalBtnText = pdfDownloadBtn.textContent; pdfDownloadBtn.textContent = 'Generating...'; pdfDownloadBtn.disabled = true; try { // Use html2canvas to capture the element html2canvas(captureElement, { useCORS: true, backgroundColor: '#ffffff', // Force white background onrendered: function(canvas) { // Fallback for older html2canvas versions console.warn("html2canvas onrendered fallback used"); } }).then((canvas) => { const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; // Create PDF const doc = new jsPDF({ orientation: 'landscape', unit: 'px', format: [canvas.width, canvas.height] // Use canvas dimensions }); doc.text("Abstract Concept Map", 20, 30); doc.addImage(imgData, 'PNG', 0, 0, canvas.width, canvas.height); doc.save('concept_map.pdf'); // Restore button pdfDownloadBtn.textContent = originalBtnText; pdfDownloadBtn.disabled = false; }).catch(err => { console.error('CONCEPT MAP TOOL: html2canvas error:', err); alert('An error occurred during PDF generation.'); pdfDownloadBtn.textContent = originalBtnText; pdfDownloadBtn.disabled = false; }); } catch (e) { console.error('CONCEPT MAP TOOL: PDF generation failed.', e); alert('Error: Could not generate PDF.'); pdfDownloadBtn.textContent = originalBtnText; pdfDownloadBtn.disabled = false; } } // --- Attach Event Listeners --- generateBtn.addEventListener('click', generateMap); pdfDownloadBtn.addEventListener('click', downloadPDF); // --- Initial Setup --- updateNavButtons(); checkLibraries(); });
Scroll to Top