In this guide, you’ll learn how to configure the prebuilt editor (Design Editor, Photo Editor, etc.) to export designs as PDFs. You can keep the built-in file write and share behavior, or inject export options (DPI, underlayer, high compatibility) while preserving the default flow.
What You’ll Learn#
- Switch the prebuilt editor’s export to PDF via
onExport. - Preserve the default event flow (share file) without custom UI code.
- Add export options (DPI, high-compat, underlayer) for design scenes.
- Keep MP4 export for video scenes while using PDF for design scenes.
When to Use It#
- You want editor UI out of the box, with export customized to PDF.
- You want to avoid writing your own share/save UI.
- You need optional export tweaks but prefer the editor’s default UX.
Export Control#
The prebuilt editors have a share control in the navigation bar. This control exports the current scene as either a PNG or MP4, depending on the scene’s mode. Then it displays a share sheet or system share dialog.

The editors provide an onExport callback you can use to control this behavior. If your export to PDF isn’t complicated, configuring the MIME type may be all you need.
val engineConfiguration = EngineConfiguration.remember( license = "<your license here>", onExport = { val engine = editorContext.engine val eventHandler = editorContext.eventHandler EditorDefaults.run { eventHandler.send(ShowLoading) runCatching { val buffer = engine.block.export( block = requireNotNull(engine.scene.get()), mimeType = MimeType.PDF, ) writeToTempFile(buffer, MimeType.PDF) }.onSuccess { file -> eventHandler.send(HideLoading) eventHandler.send(ShareFileEvent(file, MimeType.PDF.key)) }.onFailure { eventHandler.send(HideLoading) eventHandler.send(ShowErrorDialogEvent(error = it)) } } })
DesignEditor(engineConfiguration = engineConfiguration) { navController.popBackStack()}The preceding code:
- Tells the default handler to export design scenes to PDF.
- Writes the PDF to a temp file and shares it.
- Displays loading and error states using the event handler.
Adding Options to Export#
For more complex configurations, you can use ExportOptions to customize the PDF output. The onExport callback gets access to the engine and event handler.
val engineConfiguration = EngineConfiguration.remember( license = "<your license here>", onExport = { val engine = editorContext.engine val eventHandler = editorContext.eventHandler EditorDefaults.run { when (engine.scene.getMode()) { SceneMode.VIDEO -> { val page = engine.scene.getCurrentPage() ?: engine.scene.getPages()[0] runCatching { val buffer = engine.block.exportVideo( block = page, timeOffset = 0.0, duration = engine.block.getDuration(page), mimeType = MimeType.MP4, ) writeToTempFile(buffer, MimeType.MP4) }.onSuccess { file -> eventHandler.send(ShareFileEvent(file, MimeType.MP4.key)) } } else -> { eventHandler.send(ShowLoading) runCatching { val options = ExportOptions( exportPdfWithHighCompatibility = true, ) val buffer = engine.block.export( block = requireNotNull(engine.scene.get()), mimeType = MimeType.PDF, options = options, ) writeToTempFile(buffer, MimeType.PDF) }.onSuccess { file -> eventHandler.send(HideLoading) eventHandler.send(ShareFileEvent(file, MimeType.PDF.key)) }.onFailure { eventHandler.send(HideLoading) eventHandler.send(ShowErrorDialogEvent(error = it)) } } } } })The preceding code creates an ExportOptions object and passes it to the PDF export function. You can configure additional options like underlayer generation and DPI settings.
Once the PDF has been written to disk, the callback passes it to the event handler to display the share dialog. For video scenes, the callback exports as MP4 instead.
Export Options#
The ExportOptions class provides these parameters for PDF customization:
val options = ExportOptions( exportPdfWithHighCompatibility = true, // Flatten complex elements exportPdfWithUnderlayer = true, // Generate print underlayer underlayerSpotColorName = "White", // Spot color for underlayer ink underlayerOffset = -2.0f, // Offset in design units)Available options:
exportPdfWithHighCompatibility: Flatten PDF for better compatibility with older viewers.exportPdfWithUnderlayer: Generate an underlayer shape for specialized printing (fabric, glass).underlayerSpotColorName: Specify the spot color name for the underlayer ink.underlayerOffset: Adjust underlayer size with positive (larger) or negative (smaller) offset.
Troubleshooting#
❌ Export still shares PNG/MP4:
- Ensure
MimeType.PDFis specified in theonExportcallback. - Verify the callback is properly configured in
EngineConfiguration.
❌ PDF looks soft:
- Check the “scene/dpi” property of the scene and increase it if necessary.
- Ensure placed images have enough pixels to cover the frame.
❌ Underlayer absent in output:
- Verify the spot color name is correct and matches what the printer expects.
- Ensure
exportPdfWithUnderlayer = trueis set inExportOptions. - Do not flatten the PDF or the underlayer will be lost.
❌ Video scene shows different flow:
- This is expected. The SDK exports videos slightly differently than static image scenes.
Next Steps#
Now that you know how to configure the editor to export to PDF, here are some topics to explore:
- Spot Colors – use spot colors for specialized printing.
- Asset Sources & Upload – bring user images/videos in, then export as PDF.