Speech Writing Assistant

Speech Writing Assistant

Structure your perfect speech, from introduction to conclusion.

Key Point ${index + 1}: Develop your argument around this central idea: "${point}". Provide supporting evidence, tell a personal story, or share a relevant example to make your point compelling and relatable.

`; }); speechHTML += `

Conclusion

Summary: Briefly recap your main points to reinforce the message.

Closing Statement: End with a powerful and memorable statement. This is where you can deliver your call to action or final thought: "${data.conclusion}".

Thank You: Conclude by thanking the audience for their time and attention.

`; inputs.speechOutput.innerHTML = speechHTML; inputs.pdfButtonContainer.style.display = 'block'; }; const downloadPDF = () => { try { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const data = { occasion: inputs.occasion.value || 'this special event', audience: inputs.audience.value, objective: inputs.objective.options[inputs.objective.selectedIndex].text, tone: inputs.tone.value, hook: inputs.hook.value || 'a thought-provoking idea', point1: inputs.point1.value, point2: inputs.point2.value, point3: inputs.point3.value, conclusion: inputs.conclusion.value || 'a memorable final thought' }; const keyPoints = [data.point1, data.point2, data.point3].filter(p => p.trim() !== ''); const pageWidth = doc.internal.pageSize.getWidth(); const margin = 15; let cursorY = 20; // --- PDF Header --- doc.setFont('helvetica', 'bold'); doc.setFontSize(18); doc.text('Speech Outline & Guide', pageWidth / 2, cursorY, { align: 'center' }); cursorY += 10; doc.setLineWidth(0.5); doc.line(margin, cursorY, pageWidth - margin, cursorY); cursorY += 5; // --- Parameters Table --- doc.autoTable({ startY: cursorY, head: [['PARAMETER', 'YOUR SELECTION']], body: [ ['Occasion:', data.occasion], ['Audience:', data.audience], ['Objective:', data.objective], ['Tone:', data.tone] ], theme: 'grid', headStyles: { fillColor: [37, 99, 235], font: 'helvetica', fontStyle: 'bold' }, bodyStyles: { font: 'helvetica' } }); cursorY = doc.previousAutoTable.finalY + 15; const addSection = (title, content) => { if (cursorY > doc.internal.pageSize.getHeight() - 30) { doc.addPage(); cursorY = margin; } doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.text(title, margin, cursorY); cursorY += 7; doc.setFont('helvetica', 'normal'); doc.setFontSize(11); const textLines = doc.splitTextToSize(content, pageWidth - margin * 2); doc.text(textLines, margin, cursorY); cursorY += textLines.length * 5 + 8; }; addSection('Introduction', `Hook Idea: "${data.hook}".\nWelcome your audience and state the purpose of your speech (${data.objective}).`); doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.text('Body', margin, cursorY); cursorY += 7; keyPoints.forEach((point, index) => { addSection(`Key Point ${index + 1}`, `Elaborate on: "${point}". Use facts, stories, or examples to support this idea.`); }); addSection('Conclusion', `Summarize your key points.\nDeliver your final call to action or closing thought: "${data.conclusion}".\nEnd with a thank you.`); doc.save('Speech_Outline.pdf'); } catch (error) { console.error("Failed to generate PDF:", error); if (inputs.pdfButtonContainer && !inputs.pdfButtonContainer.querySelector('.error-msg')) { const errorMsg = document.createElement('p'); errorMsg.textContent = 'Sorry, the PDF could not be created.'; errorMsg.className = 'text-red-600 text-sm mt-2 error-msg'; inputs.pdfButtonContainer.appendChild(errorMsg); } } }; downloadPdfButton.addEventListener('click', downloadPDF); updateTabs(); });
Scroll to Top