Case Study Summary Generator

Case Study Summary Generator

Distill lengthy case studies into actionable insights instantly.

Case Study Details

Awaiting Analysis

Provide the case study text to generate a summary.

No data available.

'; if (Array.isArray(content)) { return `
    ${content.map(item => `
  • ${item}
  • `).join('')}
`; } return `

${content}

`; } function showTab(index) { const tabs = tabsContainer.querySelectorAll('.tab'); const contents = tabContentsContainer.querySelectorAll('.tab-content'); tabs.forEach(tab => tab.classList.remove('active')); contents.forEach(content => content.classList.remove('active')); if(tabs[index]) tabs[index].classList.add('active'); if(contents[index]) contents[index].classList.add('active'); currentTabIndex = index; updateNavButtons(); } function navigateTabs(direction) { const tabs = tabsContainer.querySelectorAll('.tab'); const newIndex = currentTabIndex + direction; if (newIndex >= 0 && newIndex < tabs.length) showTab(newIndex); } function updateNavButtons() { const tabs = tabsContainer.querySelectorAll('.tab'); prevTabBtn.disabled = currentTabIndex === 0; nextTabBtn.disabled = tabs.length - 1; } function generatePdf() { if (!window.jspdf || !latestGeneratedData) { alert("Please generate a summary before downloading."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'letter' }); const pageHeight = doc.internal.pageSize.getHeight(); const pageWidth = doc.internal.pageSize.getWidth(); const margin = 60; let cursorY = margin; // Header doc.setFont("Tinos", "bold"); doc.setFontSize(10); doc.setTextColor(100, 116, 139); // Slate-500 doc.text("MEMORANDUM", margin, cursorY); cursorY += 20; doc.setDrawColor(226, 232, 240); // Slate-200 doc.setLineWidth(1.5); doc.line(margin, cursorY, pageWidth - margin, cursorY); cursorY += 20; // Memo Details const today = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); const memoDetails = [ { label: 'TO:', value: 'Interested Parties' }, { label: 'FROM:', value: 'Automated Analysis Unit' }, { label: 'DATE:', value: today }, { label: 'SUBJECT:', value: latestGeneratedData.title || 'Case Study Analysis' } ]; doc.setFont("Inter", "bold"); doc.setFontSize(10); memoDetails.forEach(detail => { doc.text(detail.label, margin, cursorY); doc.setFont("Inter", "normal"); doc.text(detail.value, margin + 60, cursorY); doc.setFont("Inter", "bold"); cursorY += 15; }); cursorY += 10; doc.line(margin, cursorY, pageWidth - margin, cursorY); cursorY += 25; // Body const drawSection = (title, content) => { if (!content) return; doc.setFont("Tinos", "bold"); doc.setFontSize(14); doc.setTextColor(30, 41, 59); // Slate-800 const titleLines = doc.splitTextToSize(title, pageWidth - margin*2); if (cursorY + (titleLines.length * 16) > pageHeight - margin) { doc.addPage(); cursorY = margin; } doc.text(title, margin, cursorY); cursorY += titleLines.length * 16 + 5; doc.setFont("Inter", "normal"); doc.setFontSize(10); let text; if (Array.isArray(content)) { text = content.map(item => `- ${item}`).join('\n'); } else { text = content; } const textLines = doc.splitTextToSize(text, pageWidth - margin * 2); if (cursorY + (textLines.length * 12) > pageHeight - margin) { doc.addPage(); cursorY = margin; } doc.text(textLines, margin, cursorY, { lineHeightFactor: 1.5 }); cursorY += textLines.length * 12 * 1.5 + 20; }; drawSection("Executive Summary", latestGeneratedData.executive_summary); drawSection("Problem & Solution", latestGeneratedData.problem_solution); drawSection("Key Findings", latestGeneratedData.key_findings); drawSection("Actionable Insights", latestGeneratedData.actionable_insights); const safeFileName = (latestGeneratedData.title || 'case_study_summary').replace(/[^a-z0-9]/gi, '_').toLowerCase(); doc.save(`${safeFileName}.pdf`); } setUIState('placeholder'); });
Scroll to Top