Policy Brief Template Generator

Policy Brief Template Generator

Your generated brief will appear here. It is fully editable.

By: ${author}
Date: ${date}

Executive Summary

This section provides a high-level overview. A concise summary of the problem and the key recommendation. For this template, it combines the introduction and recommendation.

${problem}

Key Recommendation: ${recommendation}

Background of the Problem

(This is where you would provide detailed context, history, and data supporting the problem statement.)

Analysis of Policy Options

${optionsHtml}

Conclusion

(Summarize the importance of addressing the issue and reiterate why the recommended policy is the best course of action.)

${sourcesHtml} `; briefOutput.innerHTML = html; } /** * PDF Download Functionality using html2canvas */ async function downloadPDF() { if (!briefOutput.innerText.trim() || briefOutput.innerText.includes("will appear here")) { alert("Please generate a brief before downloading."); return; } const { jsPDF } = window.jspdf; const pdf = new jsPDF('p', 'pt', 'a4'); pdfButton.innerText = 'Generating...'; pdfButton.disabled = true; try { const canvas = await html2canvas(briefOutput, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const imgProps = pdf.getImageProperties(imgData); const pdfWidth = pdf.internal.pageSize.getWidth(); const ratio = imgProps.height / imgProps.width; const pdfHeight = (pdfWidth - 40) * ratio; // A4 page height pdf.addImage(imgData, 'PNG', 20, 20, pdfWidth - 40, pdfHeight); const fileName = (policyTitleInput.value || 'Policy_Brief').replace(/[^a-z0-9]/gi, '_').toLowerCase(); pdf.save(`${fileName}.pdf`); } catch (error) { console.error("PBTG TOOL: PDF Generation Error - ", error); alert("An error occurred while generating the PDF."); } finally { pdfButton.innerText = 'Download Brief (PDF)'; pdfButton.disabled = false; } } // --- Event Listeners --- addOptionButton.addEventListener('click', () => addPolicyOption()); nextButton.addEventListener('click', () => { if (currentTabIndex === 0) { generateBrief(); pbtg_showTab(1); } }); prevButton.addEventListener('click', () => { if (currentTabIndex > 0) { pbtg_showTab(currentTabIndex - 1); } }); pdfButton.addEventListener('click', downloadPDF); // --- Initial Setup --- // Set today's date dateInput.valueAsDate = new Date(); // Add sample data addPolicyOption('Option A: Status Quo', 'Continue with current cybersecurity policies. Pros: No new costs. Cons: Fails to address emerging, sophisticated threats.'); addPolicyOption('Option B: Federal Grant Program', 'Establish a public-private partnership grant program to fund security upgrades. Pros: Encourages adoption of best practices. Cons: Requires significant federal funding.'); // Generate initial brief generateBrief(); }); // --- End of DOMContentLoaded --- // --- Global Functions for onclick --- window.pbtg_openTab = function(evt, tabName) { const tabs = ['pbtg-tab-config', 'pbtg-tab-dashboard']; const newIndex = tabs.indexOf(tabName); if(newIndex === -1) return; // To keep logic scoped, we simulate a click on the nav buttons if (newIndex === 0) { document.getElementById('pbtg-prev-button').click(); } else if (newIndex === 1) { // Manually trigger generation if user clicks tab directly document.getElementById('pbtg-next-button').click(); } }; })();
Scroll to Top