Skip to Content
PDF Reports

PDF Reports

Generate a PDF from a completed scan to give the person a copy of their results. Your app can email the report, show it in a browser, retrieve a temporary link, or get the PDF bytes to save or share.

Prerequisites

PDF generation requires a successful measurement, a license that includes PDF reports, and an internet connection. The SDK sends report data to Shen AI’s PDF service, including available measurement results and health indices. Email delivery also sends the recipient’s address. Retrieving the bytes for local storage uses the same service.

Available generation modes

What you want to doAPI to use
Email the report to the personSend to email
Let the person view or print the reportOpen in browser on platforms with a browser UI
Give the person a temporary download linkGenerate URL. The link is valid for 24 hours.
Save a copy or use your app’s sharing flowGet PDF as bytes

Send to email

Request delivery to the recipient’s address. Repeating an identical request for the same report, recipient, subject, and body is deduplicated.

shenaiSDK.sendMeasurementResultsPdfToEmail("person@example.com", success => { if (success) { console.log("Report email request succeeded") } else { console.error("Failed to send PDF") } })

Open in browser

Use this from a user action such as a View report button. The browser controls the viewing and printing experience.

shenaiSDK.openMeasurementResultsPdfInBrowser()

Generate URL

Use the temporary URL when the user needs a link. Anyone with the link can access the report while the link is valid.

shenaiSDK.getMeasurementResultsPdfUrl(url => { if (url) { reportLink.href = url // Your app’s download link } else { console.error("Couldn't generate the PDF") } })

Get PDF as bytes

Use the bytes if your app needs to keep the report beyond the link’s lifetime or pass a file to another application.

shenaiSDK.getMeasurementResultsPdfBytes(bytes => { if (bytes.length === 0) { console.error("Couldn't generate the PDF") return } const report = new Blob([new Uint8Array(bytes)], { type: "application/pdf" }) // Save or share the report from your app. })

Customizing the report

Contents. The measurement configuration selects the summary metrics and health indices displayed in the PDF. The report shows available results for that selection. To hide all health indices in the report, disable enableHealthRisks. This also affects the SDK interface.

Language. The report and default email text use the SDK language selected at generation time. If you supply your own email text, provide it in the recipient’s language.

Measurement timestamp

The report includes the scan’s start time by default, with the device’s UTC offset when available. Set includeTimestampInPdf at initialization or in Remote Configuration, or change it before requesting a report.

shenaiSDK.setIncludeTimestampInPdf(false) const includeTimestamp = shenaiSDK.getIncludeTimestampInPdf()

Logo and email text

Upload your report logo in the Playground  and save it as part of the license’s Remote Configuration. On the web, you can also pass the uploaded logo ID as pdfLogoId during initialization or call setPdfLogoId before generating the report. An empty ID clears the custom logo.

To customize the email, set pdfEmailSubject and pdfEmailBody during initialization or in Remote Configuration, or use the setters below. Pass an empty string to a setter to restore its localized default.

shenaiSDK.setPdfEmailSubject("Your measurement report") shenaiSDK.setPdfEmailBody("Your report is attached.") shenaiSDK.setPdfLogoId(logoId)