Hand-to-Back Test (Internal)
Right Hand: ${interpretations[results.hand_back_right].text}
Left Hand: ${interpretations[results.hand_back_left].text}
${resultsHTML}
This report is for informational purposes only and does not substitute for a professional medical evaluation.
`; document.body.appendChild(pdfExportContainer); try { const canvas = await html2canvas(pdfExportContainer, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgHeight = canvas.height * pdfWidth / canvas.width; pdf.addImage(imgData, 'PNG', 15, 15, pdfWidth - 30, imgHeight - 30); pdf.save('Shoulder-Mobility-Report.pdf'); } catch (error) { console.error("PDF Generation Failed:", error); alert("An error occurred while generating the PDF."); } finally { document.body.removeChild(pdfExportContainer); } }); });