Recommendations & Next Steps
${result.recommendations.map(rec => `- ${rec}
`).join('')}
Important Disclaimer:
This tool is an informational screening and NOT a diagnostic tool. It cannot replace a consultation with a qualified healthcare professional. If you are concerned about your mental health, please see a doctor or mental health provider. If you are in crisis or having thoughts of harming yourself, please contact a crisis line or go to the nearest emergency room immediately.
`;
}
function downloadResultPDF() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF({ unit: 'pt', format: 'a4' });
const docWidth = doc.internal.pageSize.getWidth();
const margin = 40;
let currentY = margin;
// Header
doc.setFont('helvetica', 'bold');
doc.setFontSize(22);
doc.setTextColor(79, 70, 229);
doc.text('Depression Symptom Checker Report', margin, currentY);
currentY += 25;
doc.setFont('helvetica', 'normal');
doc.setFontSize(10);
doc.setTextColor(108, 117, 125);
doc.text(`Report Date: ${new Date().toLocaleDateString('en-US')}`, margin, currentY);
currentY += 40;
const addSectionHeader = (title) => {
doc.setFont('helvetica', 'bold');
doc.setFontSize(14);
doc.setTextColor(33, 37, 41);
doc.text(title, margin, currentY);
currentY += 15;
doc.setDrawColor(222, 226, 230);
doc.line(margin, currentY, docWidth - margin, currentY);
currentY += 25;
};
// Assessment Result
addSectionHeader('Assessment Result');
doc.setFontSize(12);
doc.text('Symptom Severity Level:', margin, currentY);
doc.setFont('helvetica', 'bold');
doc.setFontSize(16);
const levelColor = lastResult.level === 'Severe' || lastResult.level === 'Moderately Severe' ? [220, 38, 38] : lastResult.level === 'Moderate' ? [202, 138, 4] : [22, 163, 74];
doc.setTextColor(levelColor[0], levelColor[1], levelColor[2]);
doc.text(lastResult.level, margin + 170, currentY);
currentY += 25;
doc.setFont('helvetica', 'normal');
doc.setFontSize(11);
doc.setTextColor(55, 65, 81);
const scoreText = `Your score of ${lastResult.score} (out of 27) was used to determine this level.`;
doc.text(scoreText, margin, currentY);
currentY += 20;
const descLines = doc.splitTextToSize(lastResult.description, docWidth - margin * 2);
doc.text(descLines, margin, currentY);
currentY += descLines.length * 12 + 30;
// Recommendations
addSectionHeader('Recommendations & Next Steps');
doc.setFontSize(11);
lastResult.recommendations.forEach(rec => {
if (currentY > doc.internal.pageSize.getHeight() - 80) {
doc.addPage();
currentY = margin;
}
doc.text(`• ${rec}`, margin, currentY, { maxWidth: docWidth - margin * 2 });
currentY += 20;
});
// Disclaimer
const pageHeight = doc.internal.pageSize.getHeight();
doc.setFont('helvetica', 'bold');
doc.setFontSize(10);
doc.setTextColor(220, 38, 38);
const disclaimerY = pageHeight - 60;
doc.text('CRITICAL DISCLAIMER: This is not a medical diagnosis.', margin, disclaimerY);
doc.setFont('helvetica', 'normal');
doc.setFontSize(9);
doc.setTextColor(108, 117, 125);
doc.text('This tool is for informational purposes only. Please consult a healthcare professional for a proper diagnosis and treatment plan. If you are in crisis, contact a crisis hotline or emergency services immediately.', margin, disclaimerY + 15, { maxWidth: docWidth - margin * 2 });
doc.save('Depression-Symptom-Report.pdf');
}