Press Release Writer

Press Release Writer

Craft a professional press release in minutes.

1
Headline
2
Details
3
Preview

Step 1: Core Message

${summary}

${body.replace(/\n/g, '

')}

###

About:

${boilerplate.replace(/\n/g, '
')}

Media Contact:

${contactInfo.replace(/\n/g, '
')}

`; }, updateUI() { this.dom.steps.forEach((step, index) => { step.classList.toggle('hidden', index + 1 !== this.currentStep); }); this.dom.indicators.forEach((indicator, index) => { indicator.classList.toggle('active', index < this.currentStep); }); this.dom.lines.forEach((line, index) => { line.classList.toggle('active', index < this.currentStep - 1); }); this.dom.prevBtn.classList.toggle('hidden', this.currentStep === 1); this.dom.nextBtn.textContent = this.currentStep === 2 ? 'Generate Preview' : 'Next'; this.dom.nextBtn.classList.toggle('hidden', this.currentStep === 3); if (this.currentStep === 3) { this.generatePreview(); } }, nextStep() { if (this.currentStep < 3) { this.currentStep++; this.updateUI(); } }, prevStep() { if (this.currentStep > 1) { this.currentStep--; this.updateUI(); } }, generatePdf() { this.collectData(); const { headline, summary, body, boilerplate, contactInfo } = this.data; const { jsPDF } = window.jspdf; const pdf = new jsPDF({ unit: 'pt', format: 'a4' }); const margin = 60; const pageWidth = pdf.internal.pageSize.getWidth(); let cursorY = margin; const addWrappedText = (text, options, isFirstParagraph = false) => { const { font, style, size, spacing, isBody } = options; pdf.setFont(font, style); pdf.setFontSize(size); let paragraphs = text.split('\n'); if (isBody && isFirstParagraph) { // Don't indent the very first paragraph of the body const lines = pdf.splitTextToSize(paragraphs[0], pageWidth - (2 * margin)); pdf.text(lines, margin, cursorY); cursorY += lines.length * size * 1.15; paragraphs.shift(); // remove the first paragraph } paragraphs.forEach(paragraph => { const lines = pdf.splitTextToSize(paragraph.trim(), pageWidth - (2 * margin + (isBody ? 20 : 0))); if (lines.length > 0 && lines[0] !== '') { pdf.text(lines, margin + (isBody ? 20 : 0), cursorY); cursorY += (lines.length * size * 1.15) + spacing; } }); }; // For Immediate Release addWrappedText("FOR IMMEDIATE RELEASE", { font: 'helvetica', style: 'normal', size: 10, spacing: 20 }); // Headline addWrappedText(headline, { font: 'helvetica', style: 'bold', size: 20, spacing: 15 }); // Summary addWrappedText(summary, { font: 'helvetica', style: 'italic', size: 12, spacing: 25 }); // Body addWrappedText(body, { font: 'times', style: 'normal', size: 12, spacing: 10, isBody: true }, true); // ### pdf.setFont('helvetica', 'normal').setFontSize(14).text("###", pageWidth / 2, cursorY, { align: 'center' }); cursorY += 30; // Boilerplate addWrappedText(boilerplate, { font: 'times', style: 'normal', size: 10, spacing: 20 }); // Contact addWrappedText("Media Contact:", { font: 'helvetica', style: 'bold', size: 10, spacing: 5 }); addWrappedText(contactInfo, { font: 'helvetica', style: 'normal', size: 10, spacing: 5 }); pdf.save('Press-Release.pdf'); } }; app.init(); });
Scroll to Top