Digital Brochure Copy Generator

Digital Brochure Copy Generator

Effortlessly generate compelling copy for your marketing brochure.

${brochureData.headline?.introduction || ''}

`; // Services if (brochureData.services && brochureData.services.length > 0) { html += `
`; brochureData.services.forEach(service => { html += `

${service.serviceName}

${service.serviceDescription}

` }); html += `
`; } html += '
'; html += `
`; container.innerHTML = html; 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 = 15; const pageWidth = doc.internal.pageSize.getWidth(); const pageHeight = doc.internal.pageSize.getHeight(); const contentWidth = pageWidth - (pageMargin * 2); let y = pageMargin; // --- Helper Functions for PDF --- function checkPageBreak(neededHeight) { if (y + neededHeight > pageHeight - pageMargin) { doc.addPage(); y = pageMargin; addHeaderFooter(); } } function addHeaderFooter() { doc.setFontSize(9); doc.setTextColor('#9ca3af'); doc.text(brochureData.headline?.companyName || '', pageMargin, pageHeight - 8); doc.text(`Page ${doc.internal.getNumberOfPages()}`, pageWidth - pageMargin, pageHeight - 8, { align: 'right' }); } addHeaderFooter(); // For the first page // --- PDF Content --- // Title y = 30; doc.setFont('helvetica', 'bold'); doc.setFontSize(22); doc.setTextColor('#1f2937'); let lines = doc.splitTextToSize(brochureData.headline?.brochureHeadline || 'Brochure', contentWidth); doc.text(lines, pageWidth / 2, y, { align: 'center' }); y += (lines.length * 8) + 5; // Introduction doc.setFont('helvetica', 'normal'); doc.setFontSize(11); doc.setTextColor('#374151'); lines = doc.splitTextToSize(brochureData.headline?.introduction || '', contentWidth); doc.text(lines, pageMargin, y); y += (lines.length * 5) + 15; // About Us checkPageBreak(20); doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.setTextColor('#10b981'); doc.text('About Us', pageMargin, y); y += 8; doc.setFont('helvetica', 'normal'); doc.setFontSize(11); doc.setTextColor('#374151'); lines = doc.splitTextToSize(brochureData.about?.companyStory || '', contentWidth); doc.text(lines, pageMargin, y); y += (lines.length * 5) + 15; // Products/Services checkPageBreak(20); doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.setTextColor('#10b981'); doc.text('Our Products & Services', pageMargin, y); y += 8; if (brochureData.services && brochureData.services.length > 0) { brochureData.services.forEach(service => { doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.setTextColor('#1f2937'); const serviceNameLines = doc.splitTextToSize(service.serviceName, contentWidth); const descLines = doc.splitTextToSize(service.serviceDescription, contentWidth); checkPageBreak((serviceNameLines.length * 6) + (descLines.length * 5) + 5); doc.text(serviceNameLines, pageMargin, y); y += (serviceNameLines.length * 6); doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor('#374151'); doc.text(descLines, pageMargin, y); y += (descLines.length * 5) + 8; }); } // Call to Action & Contact doc.addPage(); y = pageMargin; addHeaderFooter(); y = pageHeight / 2 - 40; doc.setFillColor('#f3f4f6'); doc.rect(pageMargin, y - 10, contentWidth, 80, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(20); doc.setTextColor('#1f2937'); lines = doc.splitTextToSize(brochureData.cta?.callToAction || '', contentWidth - 10); doc.text(lines, pageWidth / 2, y, { align: 'center' }); y += (lines.length * 8) + 8; doc.setFont('helvetica', 'normal'); doc.setFontSize(12); doc.setTextColor('#10b981'); doc.textWithLink(brochureData.cta?.ctaLink || '', pageWidth/2, y, { align: 'center', url: brochureData.cta?.ctaLink }); y += 20; const contactInfo = [ brochureData.contact?.email, brochureData.contact?.phone, brochureData.contact?.website ].filter(Boolean).join(' | '); doc.setFontSize(10); doc.setTextColor('#4b5563'); doc.text(contactInfo, pageWidth / 2, y, { align: 'center' }); const companyFileName = (brochureData.headline?.companyName || 'Digital_Brochure').replace(/\s+/g, '_'); doc.save(`${companyFileName}.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