KPDF’s save flow exports the current PDF and opens the platform’s save-file picker so the user can choose where to store it. CallDocumentation Index
Fetch the complete documentation index at: https://mahmoud-b28887f9.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
requestSave() (or the alias savePdf()) to start the flow. The SDK writes the file once the user selects a destination. Observe saveState to update your UI throughout the process.
Basic save
Suggesting a file name
Pass asuggestedFileName to pre-fill the file name in the platform picker:
savePdf() is an alias for requestSave() with the same parameters — use whichever reads more clearly at your call site.
KPdfSaveState variants
saveState is a StateFlow<KPdfSaveState>. Handle each variant to give users accurate feedback.
| State | When it occurs | What it carries | Suggested UI reaction |
|---|---|---|---|
Idle | No save in progress | — | No indicator |
Exporting | SDK is serialising the PDF bytes | — | Show a progress indicator |
AwaitingDestination | Platform save picker is open | requestId, suggestedFileName, mimeType | Tell the user to pick a save location |
Success | File written successfully | requestId, suggestedFileName, mimeType, location? | Show a confirmation, optionally surface the save path |
Cancelled | User dismissed the picker | requestId, suggestedFileName, mimeType | Dismiss the indicator silently |
Error | Export or write failed | reason, suggestedFileName?, mimeType? | Show an error message with the failure reason |