Documentation Index
Fetch the complete documentation index at: https://setup.despia.com/llms.txt
Use this file to discover all available pages before exploring further.
fileviewer:// opens any remote file in a native previewer without forcing the user out of your app. iOS renders the file through QuickLook; Android renders it through Despia’s in-app file viewer, built to match QuickLook’s fidelity so output stays consistent regardless of what apps the user has installed.
Useful for invoices, statements, contracts, exported reports, generated PDFs, and any other case where you would otherwise navigate the user to a hosted file URL and lose your app’s context.
Installation
- Bundle
- CDN
How it works
Pass an absolute HTTPS URL as thesrc parameter. The native side downloads the file off the main thread, resolves its type from the URL extension (falling back to the response Content-Type), and hands it to the previewer. The call is fire-and-forget; there is no JS callback.
src through encodeURIComponent so the scheme separator, slashes, and any query characters survive transit.
| Parameter | Required | Description |
|---|---|---|
src | Yes | Absolute HTTPS URL of the file. Must be percent-encoded. |
theme | No | light or dark. Overrides the system appearance for the previewer UI. Omit to follow the device’s system theme. |
Matching the previewer to your app’s theme
Passtheme=light or theme=dark when your app overrides the OS appearance and you want the previewer to follow your app’s setting instead of the device default. Omit theme entirely to fall back to the system appearance.
theme is a plain string and does not need encoding; only src needs encodeURIComponent.
Authenticating the file URL
The native fetch is a plain HTTPS request made from outside your web session, so it does not carry the user’s cookies. Any file behind authentication has to be reachable through the URL itself. The standard pattern is a short-lived signed URL generated by your backend.Generated or canvas-exported files
If your app produces a file on the client, a canvas export, a generated PDF, a CSV built in memory, upload it first and then pass the returned URL to the scheme.Resources
NPM Package
despia-native