Event Invitation Copy Generator

Event Invitation Copy Generator

Craft the perfect invitation for any occasion.

Event Basics

Logistics

Invitation Wording

Generated Invitation

Copied to clipboard!

${data.date}

at ${data.time}

${data.venue}

${data.address}

${data.cta}

${data.rsvp}

`; } function showMessage() { messageBox.classList.remove('opacity-0', 'translate-y-10'); messageBox.classList.add('opacity-100', 'translate-y-0'); setTimeout(() => { messageBox.classList.remove('opacity-100', 'translate-y-0'); messageBox.classList.add('opacity-0', 'translate-y-10'); }, 2000); } function generateInvitationPdf() { const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const data = getFormData(); const pageW = pdf.internal.pageSize.getWidth(); const pageH = pdf.internal.pageSize.getHeight(); const margin = 20; // --- Build PDF Document --- // Background & Border pdf.setFillColor('#fefce8'); // yellow-50 pdf.rect(0, 0, pageW, pageH, 'F'); pdf.setDrawColor('#ca8a04'); // yellow-600 pdf.setLineWidth(1.5); pdf.rect(margin / 2, margin / 2, pageW - margin, pageH - margin); pdf.setDrawColor('#eab308'); // yellow-500 pdf.setLineWidth(0.5); pdf.rect(margin / 2 + 2, margin / 2 + 2, pageW - margin - 4, pageH - margin - 4); pdf.setTextColor('#44403c'); // stone-700 // Host pdf.setFontSize(14); pdf.setFont('helvetica', 'normal'); pdf.text(data.host.toUpperCase(), pageW / 2, 60, { align: 'center', charSpace: 1 }); // Request line pdf.setFontSize(12); pdf.setFont('times', 'italic'); pdf.text('requests the pleasure of your company at the', pageW / 2, 70, { align: 'center' }); // Event Name pdf.setFontSize(28); pdf.setFont('times', 'bold'); pdf.setTextColor('#a16207'); // yellow-700 pdf.text(data.eventName, pageW / 2, 85, { align: 'center' }); // Body pdf.setFontSize(12); pdf.setFont('times', 'normal'); pdf.setTextColor('#44403c'); const bodyLines = pdf.splitTextToSize(data.body, pageW - (margin * 4)); pdf.text(bodyLines, pageW / 2, 100, { align: 'center' }); // Details let y = 130; pdf.setFontSize(14); pdf.setFont('helvetica', 'bold'); const details = [data.date, `at ${data.time}`, data.venue, data.address]; details.forEach(line => { if(line) { pdf.text(line, pageW / 2, y, { align: 'center' }); y += 10; } }); // CTA pdf.setFont('helvetica', 'bold'); const ctaLines = pdf.splitTextToSize(data.cta, pageW - (margin * 4)); pdf.text(ctaLines, pageW / 2, 180, { align: 'center' }); // RSVP pdf.setFontSize(11); pdf.setFont('helvetica', 'normal'); const rsvpLines = pdf.splitTextToSize(data.rsvp, pageW - (margin * 4)); pdf.text(rsvpLines, pageW / 2, 190, { align: 'center' }); pdf.save(`Invitation_${data.eventName.replace(/\s+/g, '_').substring(0,20)}.pdf`); } // --- Event Listeners & Init --- tabs.forEach(tab => tab.addEventListener('click', () => goToTab(parseInt(tab.dataset.tab)))); prevButton.addEventListener('click', () => goToTab(currentTab - 1)); nextButton.addEventListener('click', () => goToTab(currentTab + 1)); copyButton.addEventListener('click', () => { const preview = document.getElementById('invitation-preview-container'); if (preview) { navigator.clipboard.writeText(preview.innerText).then(() => { showMessage(); }).catch(err => console.error('Copy failed: ', err)); } }); pdfDownloadButton.addEventListener('click', generateInvitationPdf); updateTabUI(); });
Scroll to Top