DEV Community

Ismoy Belizaire
Ismoy Belizaire

Posted on • Edited on

Multi-Platform PDF Support and UI Customization in ImagePickerKMP

Modern mobile applications often need to handle more than just photos. From scanning receipts to uploading identification documents, the ability to pick PDF files alongside images is a critical requirement. ImagePickerKMP provides a unified API to handle both media and documents across Android, iOS, Desktop, and Web.

The official documentation at https://imagepickerkmp.dev/ highlights PDF support and UI Customization as core pillars of the library.

Seamless PDF Support Across Platforms

ImagePickerKMP simplifies document workflows by allowing developers to define exactly what types of files their users can select. By integrating with native system pickers, it ensures a familiar experience for the user while providing a consistent API for the developer.

Platform PDF Selection Experience
Android System File Picker Integrated with Storage Access Framework
iOS UIDocumentPicker Native iOS document browsing
Desktop/Web Native File Dialog Standard desktop/browser file selection

How to enable PDF picking

To allow PDF selection in your gallery, you just need to update the mimeTypes in your GalleryConfig:

val picker = rememberImagePickerKMP(
    config = ImagePickerKMPConfig(
        galleryConfig = GalleryConfig(
            mimeTypes = listOf(
                MimeType.IMAGE_ALL, 
                MimeType.APPLICATION_PDF
            )
        )
    )
)
Enter fullscreen mode Exit fullscreen mode

UI Customization: Making the Picker Yours

One of the strengths of ImagePickerKMP is its flexibility. You don't have to settle for a generic look; you can customize the camera interface to match your app's branding.

Customizing Icons and Colors

Through the UiConfig, you can change button colors, icons, and even the size of the capture controls:

val picker = rememberImagePickerKMP(
    config = ImagePickerKMPConfig(
        uiConfig = UiConfig(
            cameraButtonColor = Color.Blue,
            flashIcon = myCustomFlashIcon,
            cameraButtonSize = 72.dp
        )
    )
)
Enter fullscreen mode Exit fullscreen mode

Custom Dialogs

If you need complete control over the user experience, you can even provide your own @Composable functions for permission requests and post-capture confirmation screens via PermissionAndConfirmationConfig.

Conclusion

By combining robust PDF support with deep UI customization, ImagePickerKMP empowers developers to build professional, document-ready applications without the complexity of handling platform-specific APIs.

For the full list of customizable parameters and the latest API reference, visit the official site at https://imagepickerkmp.dev/.

References

[1]: ImagePickerKMP Documentation
[2]: ImagePickerKMP GitHub Repository
[3]: ImagePickerKMP v1.0.42 Release
[4]: UI Customization Guide

Top comments (0)