Google Ads Description Generator

Your generated descriptions will appear here as previews.

'; return; } let html = '

Description Previews

'; lines.forEach((line, index) => { const cleanLine = line.substring(line.indexOf('* ') + 2).trim(); html += `

${cleanLine}

`; }); previewBodyEl.innerHTML = html; }; const handleDownloadPdf = () => { if (!window.jspdf) { console.error('jsPDF not loaded.'); return; } const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pageW = pdf.internal.pageSize.getWidth(); const margin = 50; let cursorY = 0; // --- PDF Template: Ad Creative Brief --- // Header pdf.setFillColor(241, 245, 249); // Slate 100 pdf.rect(0, 0, pageW, 70, 'F'); pdf.setFont('helvetica', 'bold').setFontSize(20).setTextColor(30, 58, 138); // Blue 900 pdf.text('Google Ads Creative Brief', margin, 45); cursorY = 110; const addSection = (title, content) => { pdf.setFont('helvetica', 'bold').setFontSize(10).setTextColor(100, 116, 139); // Slate 500 pdf.text(title.toUpperCase(), margin, cursorY); cursorY += 15; const contentLines = pdf.setFont('helvetica', 'normal').setFontSize(12).setTextColor(51, 65, 85) // Slate 700 .splitTextToSize(content, pageW - margin * 2); pdf.text(contentLines, margin, cursorY); cursorY += (contentLines.length * 12) + 20; }; addSection("Product/Service", productNameEl.value || 'N/A'); addSection("Key Features & Benefits", keyBenefitsEl.value || 'N/A'); addSection("Promotion/Offer", promotionEl.value || 'N/A'); addSection("Call to Action", ctaEl.value || 'N/A'); cursorY += 10; pdf.setDrawColor(226, 232, 240).line(margin, cursorY - 5, pageW - margin, cursorY - 5); // Slate 200 pdf.setFont('helvetica', 'bold').setFontSize(16).setTextColor(59, 130, 246); // Blue 500 pdf.text('GENERATED DESCRIPTIONS', margin, cursorY + 20); cursorY += 45; const generatedLines = (generatedDescriptionsEl.value || "No copy generated.").split('\n'); for (const line of generatedLines) { if (line.trim().startsWith('* ')) { if (cursorY > pdf.internal.pageSize.getHeight() - margin - 30) { pdf.addPage(); cursorY = margin; } const cleanLine = line.substring(line.indexOf('* ') + 2).trim(); pdf.setFillColor(241, 245, 249); // Slate 100 pdf.setDrawColor(226, 232, 240); // Slate 200 const textLines = pdf.setFont('helvetica', 'normal').setFontSize(11).setTextColor(71, 85, 105) // Slate 600 .splitTextToSize(cleanLine, pageW - margin * 2 - 20); const boxHeight = textLines.length * 11 + 20; pdf.roundedRect(margin, cursorY, pageW - margin*2, boxHeight, 5, 5, 'FD'); pdf.text(textLines, margin + 10, cursorY + 15); cursorY += boxHeight + 10; } } pdf.save(`Google-Ads-Descriptions-${(productNameEl.value || 'Untitled').replace(/\s+/g, '-')}.pdf`); }; // --- Event Listeners --- if (generateBtn) generateBtn.addEventListener('click', handleGenerateClick); if (downloadPdfBtn) downloadPdfBtn.addEventListener('click', handleDownloadPdf); });
Scroll to Top