Script Breakdown Tool

Script Breakdown Tool

Analyze your script and tag elements for production.

Project & Script

Script

Tagged Elements

Breakdown Report

No elements have been tagged. Go to the Breakdown tab to start tagging your script.

'; } } // --- PDF GENERATION --- document.getElementById('download-pdf-btn').addEventListener('click', async () => { const button = document.getElementById('download-pdf-btn'); button.disabled = true; button.textContent = 'Generating...'; const grouped = breakdownData.elements.reduce((acc, el) => { (acc[el.category] = acc[el.category] || []).push(el); return acc; }, {}); let reportSectionsHtml = ''; Object.keys(CATEGORIES).forEach(key => { if (grouped[key] && grouped[key].length > 0) { const category = CATEGORIES[key]; const tableRows = grouped[key].map(item => ` ${item.text}${item.scene}`).join(''); reportSectionsHtml += `
${category.label}
${tableRows}
ElementScene
`; } }); const reportHtml = `

Script Breakdown Report

Project: ${breakdownData.projectTitle} | Generated: ${new Date().toLocaleDateString("en-US")}

${reportSectionsHtml || '

No elements were tagged in this breakdown.

'}
`; const pdfTemplate = document.getElementById('pdf-template'); 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(`${breakdownData.projectTitle.replace(/\s+/g, '_')}_Breakdown.pdf`); } catch(e) { console.error('PDF Generation Error:', e); } finally { button.disabled = false; button.textContent = 'Download Report as PDF'; pdfTemplate.classList.add('invisible'); } }); // --- INITIALIZATION --- switchTab(0); createTaggerButtons(); renderTaggedItems(); });
Scroll to Top