惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
GbyAI
GbyAI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园_首页
D
Docker
S
Security @ Cisco Blogs
K
Kaspersky official blog
爱范儿
爱范儿
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Troy Hunt's Blog
Cloudbric
Cloudbric
博客园 - 三生石上(FineUI控件)
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Hacker News
The Hacker News
美团技术团队
S
SegmentFault 最新的问题
L
Lohrmann on Cybersecurity
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Martin Fowler
Martin Fowler
Google Online Security Blog
Google Online Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tor Project blog
Vercel News
Vercel News
The Cloudflare Blog
G
Google Developers Blog
T
Threat Research - Cisco Blogs
AI
AI
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Scott Helme
Scott Helme
S
Schneier on Security
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog
S
Securelist
IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK How Subject scaled 5× with Nutrient’s PDF SDK without rebuilding its document layer I replaced our sales training with an AI coach that runs in Slack — here’s what broke Redirecting to: https://securitybuzz.com/cybersecurity-news/why-enterprise-permissions-are-ais-most-dangerous-inheritance/ Nutrient .NET SDK vs. iText Core: Complete comparison for .NET developers DocuVieware: Support’s most frequently asked setup questions Introducing Nutrient Workflow How to convert PDF to Word in C# (.NET) When email and spreadsheets stop working: Work order approval workflows for field teams on the move Compliance with confidence: Why document-centric automation is the foundation of your mission Nutrient expands AI Assistant, automating multistep document workflows inside any application What is document generation? A developer’s guide to PDF generation Document Converter data flow and how real-time watermarks skip the queue PDF/UA compliance guide: Requirements, standards, and best practices Computers still can’t understand you How Athena Intelligence built AI agents for regulated enterprises with Nutrient’s document infrastructure How to convert HTML to PDF (2026): 4 methods from browser print to SDK How to build a document extraction pipeline with Nutrient Vision API OCR vs. intelligent document processing: Choosing the right document extraction engine Beyond OCR: How document intelligence eliminates manual processing in regulated industries Nutrient vs. IronPDF: Complete comparison for .NET developers Nutrient vs. Aspose.PDF: Complete comparison for .NET developers Redirecting to: https://fortune.com/2026/02/19/openclaw-who-is-peter-steinberger-openai-sam-altman-anthropic-moltbook/ Lufthansa Systems uses Nutrient to deliver reliable, scalable PDF rendering for pilots worldwide Nutrient vs. Syncfusion: Complete comparison for .NET developers React’s useTransition: The hook you’re probably using wrong First City Monument Bank streamlines banking processes with Nutrient Workflow Redirecting to: https://www.sdcexec.com/warehousing/automation/article/22957364/nutrient-workflow-automation-the-missing-link-in-supply-chain-efficiency The complete guide to digital signatures: PAdES, CAdES, and XAdES explained Nutrient Python SDK: Production-grade document processing for Python Introducing agentic document editing for web applications with AI Assistant Nutrient vs. QuestPDF: Complete comparison for .NET developers How we fixed the GdPicture license expiration (and what to do if you’re affected) Red team security testing with agentic AI The future of healthcare document automation Best healthcare workflow software compared Nutrient SDK product updates for Q4 2025 How Harvey scaled legal document workflows 50 percent MoM without rebuilding infrastructure HIPAA-compliant document management in hospitals How we optimized rendering performance while handling thousands of annotations in React — Part 2 Automated PII removal with Nutrient API Redirecting to: https://www.devopsdigest.com/2026-low-code-no-code-predictions Redirecting to: https://www.kmworld.com/Articles/Editorial/ViewPoints/Leaders-predict-AI-to-continue-permeating-all-aspects-of-KM-in-2026-172594.aspx What are deep agents and how do they solve complex problems? Whipping up document magic: Your easy-bake recipe for Vue and Nutrient Web SDK 🧁 What I’ve learned about product iteration planning while building SDKs Passwordless document signing: Three-layer security guide New zip folder functionality streamlines file management in Document Automation Server The keyboard shortcuts playbook: Taking control of keyboard events in Nutrient Web SDK From experienced engineer to AI beginner: My unexpected journey AI-assisted manual testing: Handling Safari’s PDF rendering and UI quirks How to keep a 20-year-old SDK up to date How we optimized rendering performance while handling thousands of annotations in React — Part 1 Nutrient announces new executive hires to accelerate next phase of growth High performance UI using web workers Automate document conversion at scale with Python and Nutrient DCS From curiosity to PLG (and AI): My journey to understanding product-led growth Prost to progress: One year as Nutrient Pigeon usage at Nutrient: Bridging native SDKs to Flutter Modernizing CI build servers: How to migrate from Chef to Ansible Unix man pages: AI-friendly documentation since 1971 Consistent hashing for even load distribution Best AI redaction APIs: Complete comparison guide for 2025 Why AI document redaction matters for modern security From coding to coordinating: How AI transformed my workflow What is intelligent document processing (IDP)? A complete guide Enterprise PDF SDKs: Best PSPDFKit (now Nutrient) alternatives Nutrient SDK product updates for Q3 2025 GdPicture support best practices Redacting sensitive data with Nutrient AI redaction API How AI is transforming the customer experience at Nutrient: From instant answers to intelligent support
Jetpack Compose: The ultimate guide
Omar Talaat · 2025-08-05 · via Inside Nutrient

Table of contents

    Jetpack Compose: The ultimate guide

    If you’re using Jetpack Compose and want to integrate Nutrient Android SDK, this post is your all-in-one scrollable spellbook. From setting up the DocumentView inside Compose to handling configuration, lifecycle, gestures, performance tips, real-world use cases, and what’s coming next — it’s all here.

    Jetpack Compose is the future of user interfaces (UIs) in Android. But if you’re wondering how to summon a full-featured document viewer like DocumentView into your modern UI world, you’re not alone. Compose doesn’t (yet) play natively with Views — and that’s where things get interesting.

    Nutrient’s DocumentView is a powerful component built with the Android View system, offering robust PDF rendering, annotations, and much more. While it’s not a Compose-native Composable, it can still shine beautifully with a few tricks.

    Integrate powerful PDF rendering into your Jetpack Compose apps in minutes — no boilerplate, no hassle. Try Nutrient Android SDK and bring your UI to life.

    Setting up your project

    Before diving into code, make sure your project is ready.

    implementation("com.pspdfkit:nutrient-compose:<latest-version>")

    • Make sure you have all permissions and ProGuard rules needed for Nutrient.

    Rendering a PDF with DocumentView

    The hero of this blog post is DocumentView, a UI component that renders PDFs, handles user interaction, and supports gestures and annotations.

    Here’s the simplest way to show a PDF using the Nutrient Compose module:

    DocumentView(

    uri = pdfUri,

    modifier = Modifier.fillMaxSize(),

    configuration = PdfActivityConfiguration.Builder(context)

    .scrollDirection(PageScrollDirection.VERTICAL)

    .build()

    )

    In the code above, you’re using DocumentView, the official Composable from our Android SDK. Modifier.fillMaxSize() tells Compose to make the PDF viewer fill the available space. No manual lifecycle handling, no XML. Just clean, idiomatic Compose.

    Jetpack Compose’s @Preview annotation is one of its standout features, allowing you to see your UI without running the entire app. While this works beautifully for most Composables, DocumentView is a platform view under the hood and may not render correctly in the Android Studio Preview window. To work around this, you can preview the container layout using mock content — such as a placeholder box or image — which mimics the size and position DocumentView would occupy. This helps with layout tuning, theming, and spacing decisions before wiring up the actual PDF viewer.

    Jetpack Compose shines when it comes to live previews. But there’s a catch — you shouldn’t preview DocumentView itself, since it depends on Android runtime resources. Instead, use placeholders:

    @Preview(

    name = "Light Mode",

    showSystemUi = true,

    uiMode = UI_MODE_NIGHT_NO,

    widthDp = 360,

    heightDp = 640

    )

    @Composable

    fun PdfViewerPreview() {

    Box(modifier = Modifier.fillMaxSize()) {

    Text("Preview Mode: PDF would render here")

    }

    }

    Want a dark mode preview?

    @Preview(

    name = "Dark Mode",

    uiMode = UI_MODE_NIGHT_YES

    )

    Check out our theming guide for more information on how to style appearance.

    Use Previews for layout scaffolding and design checks, but leave PDF rendering to the emulator or physical device.

    Styling and layout

    Compose makes it easy to compose rich UIs with Material-inspired components like Card, Box, or Surface, and DocumentView plays nicely with these when it comes to layout and presentation. Wrapping your DocumentView in a Box allows you to apply padding, constraints, or background color. A Card gives you elevation, rounded corners, and visual depth. This is particularly helpful if you’re embedding PDFs in a dashboard-style UI or want to animate visibility using Compose’s animation APIs. You’re not limited to flat, static layouts — you can style, animate, and nest DocumentView just like any other Composable.

    Want a top app bar? Compose makes it simple:

    @Composable

    fun PdfWithTopBar(context: Context, uri: Uri) {

    Scaffold(

    topBar = {

    TopAppBar(title = { Text("My PDF Viewer") })

    }

    ) { paddingValues ->

    DocumentView(

    documentSource = DocumentSource.fromUri(context, uri),

    modifier = Modifier

    .padding(paddingValues)

    .fillMaxSize()

    )

    }

    }

    You can treat DocumentView just like any other Composable. Wrap it in Column, add gestures, or animate its visibility — it plays well with the rest of your Compose UI.

    Interop: XML ↔ Compose

    Still using XML views in parts of your app? No problem. You can embed them like this:

    @Composable

    fun LegacyViewWrapper() {

    AndroidView(

    modifier = Modifier.fillMaxSize(),

    factory = { context ->

    LegacyPdfView(context).apply {

    setDocument("file:///android_asset/sample.pdf")

    }

    }

    )

    }

    This works great for publicly available XML views. But avoid using internal SDK views — they may not behave as expected.

    Managing DocumentView state

    To manage DocumentView state, there are two options, outlined below.

    1. Compose-only using rememberDocumentState(...):

      val documentState = rememberDocumentState(

      uri = pdfUri,

      configuration = PdfActivityConfiguration.Builder(context)

      .scrollDirection(PageScrollDirection.VERTICAL)

      .build()

      )

      DocumentView(documentState = documentState)

    2. ViewModel-driven with manual DocumentState creation:

      val state = DocumentState(

      uri = pdfUri,

      configuration = config

      )

    How to choose between them?

    • If you’re creating simple, self-contained Composables, use rememberDocumentState.

    val state = DocumentState(

    uri = pdfUri,

    configuration = config

    )

    How to choose between them?

    • If you’re creating simple, self-contained Composables, use rememberDocumentState.
    • For production-grade apps, managing state from your ViewModel guarantees your state retention over configuration changes.

    Final thoughts and wrapup

    Jetpack Compose is here to stay — and paired with Nutrient’s SDK, you can build snappy, scalable, and stylish PDF viewers in no time. Integrating the Nutrient SDK into Jetpack Compose is seamless. With DocumentView, you get full PDF rendering power without sacrificing Compose’s flexibility and simplicity.

    Build UI the modern way. Delight users. Make your teammates nod approvingly.

    And if you’re stuck? We’ve got your back. Submit a ticket and we’ll be more than happy to help!

    Ready to integrate powerful PDF rendering into your modern Android UI? Use Nutrient’s Compose module to combine the flexibility of Compose with the robustness of `DocumentView`. Start building today.

    Want to learn more?

    Check out these other blog posts on Jetpack Compose:

    Explore related topics

    Try for free Ready to get started?

    Related SDK articles

    Explore more