Public Awareness Campaign Generator

Public Awareness Campaign Generator

Structure your message, reach your audience, and drive change.

Your campaign plan summary will appear here once you fill out the fields in the previous tabs.

`; } }; const navigateTab = (n) => { const newIndex = currentTab + n; if (newIndex >= 0 && newIndex < tabs.length) { showTab(newIndex); } }; const downloadPDF = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const theme = document.querySelector('input[name="theme"]:checked').value; const data = formInputs.reduce((acc, input) => { if (input.id && input.value) { acc[input.id] = { label: fieldMapping[input.id], value: input.value }; } return acc; }, {}); const page = { width: doc.internal.pageSize.getWidth(), height: doc.internal.pageSize.getHeight() }; const margin = 60; let y = 0; // --- PDF Header --- doc.setFillColor(41, 128, 185); // A nice blue doc.rect(0, 0, page.width, 80, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(26); doc.setTextColor(255, 255, 255); const campaignTitle = data.campaignName ? data.campaignName.value : 'Campaign Plan'; doc.text(campaignTitle, margin, 50); y = 120; const addSection = (item) => { if (!item) return; const textLines = doc.splitTextToSize(item.value, page.width - margin * 2); const spaceNeeded = (textLines.length * 14) + 40; // Approx height needed if (y + spaceNeeded > page.height - margin) { doc.addPage(); y = margin; } doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.setTextColor(52, 73, 94); // Dark blue-gray doc.text(item.label, margin, y); y += 20; doc.setFont('helvetica', 'normal'); doc.setFontSize(11); doc.setTextColor(84, 110, 122); // Lighter blue-gray doc.text(textLines, margin, y); y += textLines.length * 14 + 15; }; if (theme === 'brief') { y = 100; doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(52, 73, 94); doc.text("EXECUTIVE BRIEF", margin, y); y += 20; const briefOrder = ['cause', 'keyMessage', 'primaryAudience', 'goals']; briefOrder.forEach(key => addSection(data[key])); } else { // professional const professionalOrder = ['cause', 'goals', 'primaryAudience', 'secondaryAudience', 'keyMessage', 'slogan', 'channels', 'activities']; professionalOrder.forEach(key => addSection(data[key])); } doc.save(`${(data.campaignName?.value || 'campaign-plan').replace(/\s+/g, '-').toLowerCase()}.pdf`); }; // Event Listeners tabs.forEach((tab, index) => tab.addEventListener('click', () => showTab(index))); prevBtn.addEventListener('click', () => navigateTab(-1)); nextBtn.addEventListener('click', () => navigateTab(1)); downloadPdfBtn.addEventListener('click', downloadPDF); // Initialization showTab(0); });
Scroll to Top