Graduation Speech Generator

Graduation Speech Generator

Craft a memorable address for the big day.

What is the Core Theme?

${speechParts.intro[theme]}

${speechParts.body[tone]}

${speechParts.message[message].replace('[Current Year]', currentYear)}

${speechParts.conclusion[action]}

Congratulations, Class of ${currentYear}!

`; const outputDisplay = document.getElementById('output-display'); if(outputDisplay) outputDisplay.innerHTML = fullSpeech; if (formContainer) formContainer.classList.add('hidden'); document.getElementById('tab-container').classList.add('hidden'); if (navButtons) navButtons.classList.add('hidden'); if (outputSection) outputSection.classList.remove('hidden'); } function downloadPDF() { const { jsPDF } = window.jspdf; if (!downloadBtn) return; downloadBtn.textContent = 'Preparing Transcript...'; downloadBtn.disabled = true; try { const speechText = document.getElementById('output-display').innerText; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); doc.setFont('times', 'normal'); const margin = 20; const pageWidth = doc.internal.pageSize.getWidth(); let yPos = margin; // --- PDF Template: Formal Transcript --- doc.setFontSize(16); doc.setFont('times', 'bold'); doc.text('Commencement Address', pageWidth / 2, yPos, { align: 'center' }); yPos += 8; doc.setFontSize(12); doc.text(`Delivered for the Graduating Class of ${new Date().getFullYear()}`, pageWidth / 2, yPos, { align: 'center' }); yPos += 10; doc.setLineWidth(0.5); doc.setDrawColor(183, 149, 11); // Gold color doc.line(margin, yPos, pageWidth - margin, yPos); yPos += 15; doc.setFont('times', 'normal'); doc.setFontSize(12); const lines = doc.splitTextToSize(speechText, pageWidth - margin * 2); doc.text(lines, margin, yPos); doc.save(`Graduation_Speech_${new Date().getFullYear()}.pdf`); } catch (error) { console.error("Error generating PDF:", error); alert("An error occurred while generating the PDF. Please try again."); } finally { downloadBtn.textContent = 'Download as Formal Transcript (PDF)'; downloadBtn.disabled = false; } } // --- Initial Setup --- showTab(currentTab); });
Scroll to Top