Magazine Advertisement Copy Generator

Magazine Ad Copy Generator

Craft persuasive copy that captivates your print audience.

${adData.cta?.specialOffer || ''}

${adData.cta?.callToAction || ''}

${adData.cta?.contactInfo || ''}

`; const pdfButton = document.getElementById('download-pdf-button'); if (pdfButton) pdfButton.addEventListener('click', downloadPDF); } // --- PDF GENERATION --- function downloadPDF() { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pageMargin = 20; const pageWidth = doc.internal.pageSize.getWidth(); const contentWidth = pageWidth - (pageMargin * 2); let y = pageMargin; // Add custom fonts if available (requires font files to be converted to base64) // For this example, we'll use standard fonts that emulate the style. // doc.addFileToVFS('PlayfairDisplay-Bold-normal.ttf', fontFile); // doc.addFont('PlayfairDisplay-Bold-normal.ttf', 'PlayfairDisplay-Bold', 'normal'); // --- PDF Content --- // Background Box (optional, for style) doc.setFillColor('#f8f7f4'); // Off-white doc.rect(0, 0, pageWidth, doc.internal.pageSize.getHeight(), 'F'); // Headline y = 40; doc.setFont('times', 'bold'); doc.setFontSize(26); doc.setTextColor('#0c2444'); // Deep Navy let lines = doc.splitTextToSize(adData.core?.mainHeadline || 'Your Headline', contentWidth); doc.text(lines, pageWidth / 2, y, { align: 'center' }); y += (lines.length * 10) + 10; // USP / Body Intro doc.setFont('helvetica', 'normal'); doc.setFontSize(11); doc.setTextColor('#333333'); lines = doc.splitTextToSize(adData.body?.usp || '', contentWidth); doc.text(lines, pageMargin, y); y += (lines.length * 5) + 15; // Benefits const benefits = adData.body?.keyBenefits.split('\n').filter(b => b); if (benefits.length > 0) { doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.text('Key Features:', pageMargin, y); y += 8; doc.setFont('helvetica', 'normal'); doc.setFontSize(10); benefits.forEach(benefit => { doc.text(`• ${benefit}`, pageMargin + 5, y); y += 6; }); } y += 15; // CTA Section const ctaYStart = 200; doc.setFillColor('#0c2444'); // Navy box doc.rect(pageMargin, ctaYStart, contentWidth, 40, 'F'); y = ctaYStart + 12; doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor('#ffffff'); if (adData.cta?.specialOffer) { doc.text(adData.cta.specialOffer, pageWidth/2, y, { align: 'center' }); y += 8; } doc.setFontSize(12); doc.text(adData.cta?.callToAction || '', pageWidth/2, y, { align: 'center' }); y += 8; doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor('#d4af37'); // Gold text doc.text(adData.cta?.contactInfo || '', pageWidth/2, y, { align: 'center' }); const fileName = (adData.core?.productName || 'Magazine_Ad').replace(/\s+/g, '_'); doc.save(`${fileName}_Copy.pdf`); } // --- EVENT LISTENERS --- nextButton.addEventListener('click', () => { if (currentTabIndex < TABS_CONFIG.length - 1) { goToTab(currentTabIndex + 1); } }); prevButton.addEventListener('click', () => { if (currentTabIndex > 0) { goToTab(currentTabIndex - 1); } }); initialize(); });
Scroll to Top