Facebook Ad Copy Generator

Facebook Ad Copy Generator

Create high-converting ad copy for your campaigns in seconds.

Ad Details

Generated Ad Copy Variations

Your generated ad copy will appear here...

${ad.primary}

Headline:

${ad.headline}

Description:

${ad.description}

`; adCopyOutput.appendChild(card); }); pdfButtonContainer.classList.remove('hidden'); }; const handlePdfDownload = () => { if (!lastAdCopy) return; const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const margin = 50; const pageWidth = pdf.internal.pageSize.getWidth(); let yPos = margin; pdf.setFontSize(24); pdf.setFont('Helvetica', 'bold'); pdf.text("Facebook Ad Copy Report", pageWidth / 2, yPos, { align: 'center' }); yPos += 20; pdf.setFontSize(14); pdf.setFont('Helvetica', 'normal'); pdf.text(`Product: "${nameEl.value}"`, pageWidth / 2, yPos, { align: 'center' }); yPos += 40; lastAdCopy.forEach((ad, index) => { if (yPos > pdf.internal.pageSize.getHeight() - 120) { pdf.addPage(); yPos = margin; } pdf.setFontSize(16); pdf.setFont('Helvetica', 'bold'); pdf.text(`Variation ${index + 1}`, margin, yPos); yPos += 25; pdf.setFontSize(10); pdf.setFont('Helvetica', 'bold'); pdf.text("Primary Text:", margin, yPos); yPos += 12; pdf.setFont('Helvetica', 'normal'); const primaryLines = pdf.splitTextToSize(ad.primary, pageWidth - margin * 2); pdf.text(primaryLines, margin, yPos); yPos += primaryLines.length * 12 + 10; pdf.setFont('Helvetica', 'bold'); pdf.text("Headline:", margin, yPos); yPos += 12; pdf.setFont('Helvetica', 'normal'); const headlineLines = pdf.splitTextToSize(ad.headline, pageWidth - margin * 2); pdf.text(headlineLines, margin, yPos); yPos += headlineLines.length * 12 + 10; pdf.setFont('Helvetica', 'bold'); pdf.text("Description:", margin, yPos); yPos += 12; pdf.setFont('Helvetica', 'normal'); const descLines = pdf.splitTextToSize(ad.description, pageWidth - margin * 2); pdf.text(descLines, margin, yPos); yPos += descLines.length * 12 + 25; }); const today = new Date().toLocaleDateString('en-US'); const pageHeight = pdf.internal.pageSize.getHeight(); pdf.setFontSize(9); pdf.setTextColor(150); pdf.text(`Generated on ${today}`, margin, pageHeight - 30); pdf.save('facebook-ad-copy.pdf'); }; generateBtn.addEventListener('click', generateAdCopy); downloadPdfBtn.addEventListener('click', handlePdfDownload); // Initial generation on load generateAdCopy(); });
Scroll to Top