How to build a React Native PDF viewer with react-native-pdf and Nutrient
Table of contents
Build a production-ready React Native PDF viewer with the Nutrient React Native PDF SDK. Add annotations, form filling, digital signatures, and a customizable user interface (UI) to your iOS and Android apps. This tutorial walks you through project setup, platform configuration, and rendering your first PDF. Start a free trial or launch the demo.
With Nutrient’s React Native PDF SDK, you can ship a fully featured PDF viewer in days instead of months. Your users get annotations, form filling, and digital signatures out of the box — features that would take significant engineering effort to build from scratch or aren’t available in open source alternatives like react-native-pdf.
Mobile apps often need to display PDFs — contracts, reports, invoices, or reference documents. PDFs are widely used across industries like education, finance, healthcare, and legal services.
With Nutrient, you can build apps that:
- Let users annotate and collaborate — Add highlights, comments, and drawings to contracts, reports, or educational materials.
- Capture signatures on mobile — Collect legally binding digital signatures without leaving your app.
- Fill and submit forms — Enable users to complete PDF forms and export the data to your backend.
This tutorial shows you how to integrate the Nutrient React Native PDF SDK into your app. It also compares it to the open source react-native-pdf(opens in a new tab) library so you can see the difference.
You’ll learn how to create a new project, add the necessary dependencies, configure platform-specific settings, and display a PDF document. By the end of this tutorial, you’ll have a fully functional PDF viewer in your React Native app.
Why Nutrient for React Native PDF viewing?
Most React Native PDF libraries only handle basic viewing. Nutrient goes further — you get a complete document experience with annotations, form filling, and signatures built in. Your team saves months of development time, and your users get a polished, native-feeling PDF viewer on both iOS and Android.
React Native PDF viewer use case
This post assumes you’re familiar with React Native and that you’ve previously developed apps using React Native. If that isn’t the case, you can use our getting started guides to create a new React Native project that uses Nutrient. Or, if you’re in a hurry, you can download our ready-to-run example project and follow the instructions from its README.
Which React Native PDF viewer should you choose?
- Use Nutrient React Native PDF SDK if you’re building a customer-facing or enterprise app. You get annotations, form filling, digital signatures, security features, and ongoing support — plus a polished UI that works on both iOS and Android.
- Use
react-native-pdfif you only need basic view-only functionality for an internal tool or prototype and don’t need advanced features.
In the video below, you can see how to open a PDF file using react-native-pdf and Nutrient React Native SDK.
Prerequisites
Before getting started, ensure you have the following:
- A development environment for React Native using the React Native CLI(opens in a new tab) (not the Expo CLI)
- The latest stable versions of Android Studio(opens in a new tab), the Android NDK(opens in a new tab), and an Android Virtual Device(opens in a new tab) or hardware device
- The latest stable versions of Xcode(opens in a new tab) and CocoaPods(opens in a new tab)
Platform-specific configuration
Android configuration
- Ensure compatibility with different Android SDK versions.
- Common issues and solutions:
- Gradle build failures — Ensure proper dependency versions in
build.gradle. - Permissions — Add required permissions in
AndroidManifest.xmlfor file access.
- Gradle build failures — Ensure proper dependency versions in
iOS configuration
- Setting up permissions:
- Add necessary permissions in
Info.plistfor document access.
- Add necessary permissions in
- Handling device orientations:
- Ensure the app supports all orientations by modifying the
UISupportedInterfaceOrientationskey.
- Ensure the app supports all orientations by modifying the
- Performance optimizations:
- Enable caching for faster load times.
Step 1 — Creating a new React Native project
Open your terminal and navigate to the directory where you want to create your project. For this example, you’ll use the ~/Documents/ directory:
cd ~/DocumentsCreate a new React Native project:
npx react-native@latest init ReactNativePDFViewerNext, you’ll add the required dependencies.
Step 2 — Installing the Nutrient dependency
Navigate to your project directory:
Terminal window cd ReactNativePDFViewerThen, add the Nutrient dependency:
yarn add @nutrient-sdk/react-nativeInstall all the dependencies for the project:
Terminal window yarn install
Step 3 — Configuring the Android platform
Open
android/build.gradleand add the Nutrient repository:allprojects {repositories {mavenCentral()maven { url 'https://my.nutrient.io/maven/' }}}Open
android/app/build.gradleand update the SDK versions:android {compileSdkVersion rootProject.ext.compileSdkVersioncompileSdkVersion 34defaultConfig {applicationId "com.reactnativepdfviewer"minSdkVersion rootProject.ext.minSdkVersionminSdkVersion 21targetSdkVersion rootProject.ext.targetSdkVersion}}
Step 4 — Configuring the iOS platform
Open
ios/Podfileand set the platform version to iOS 15:platform :ios, '11.0'platform :ios, '15.0'Navigate to the
iosfolder and install the required dependencies:Terminal window cd iospod installOpen the Workspace in Xcode:
Terminal window open ReactNativePDFViewer.xcworkspaceIn Xcode, ensure the deployment target is set to 15.0 or higher.

- Change View controller-based status bar appearance to
YESinInfo.plist.

Step 5 — Displaying a PDF document
Drag a PDF document into your project to use as a sample.
If you haven’t already, create an assets directory for Android:
Terminal window mkdir android/app/src/main/assetsPlace your PDF document in the
assetsdirectory:Terminal window cp ~/Downloads/Document.pdf android/app/src/main/assets/Document.pdfOpen
App.jsand replace its contents with the following code snippet:
import React, { Component } from 'react';import { Platform } from 'react-native';import NutrientView from '@nutrient-sdk/react-native';import { NativeModules } from 'react-native';
const Nutrient = NativeModules.Nutrient;Nutrient.setLicenseKey(null);
const DOCUMENT = Platform.OS === 'ios' ? 'Document.pdf' : 'file:///android_asset/Document.pdf';export default class NutrientDemo extends Component<{}> { render() { var pdfRef: React.RefObject<NutrientView | null> = React.createRef(); return ( <NutrientView document={DOCUMENT} configuration={{ showThumbnailBar: 'scrollable', pageTransition: 'scrollContinuous', scrollDirection: 'vertical', }} ref={pdfRef} fragmentTag="PDF1" style={{ flex: 1 }} /> ); }}Step 6 — Launching the app
Run the app on your chosen platform:
npx react-native run-androidnpx react-native run-iosWhy Nutrient instead of react-native-pdf?
Both libraries display PDFs, but Nutrient delivers a production-ready experience. Here’s how they compare:
| Feature | react-native-pdf | Nutrient React Native PDF SDK |
|---|---|---|
| Cost | Free (open source) | Paid (commercial) |
| Features | Basic viewing, zooming | Advanced features (annotations, search, forms) |
| Performance | Moderate | Optimized for high performance |
| Ease of integration | Simple | Requires licensing setup |
| Customization options | Limited | Extensive UI customization |
| Community support | Active, open source | Professional support available |
| Platform compatibility | Android, iOS | Android, iOS |
Bottom line:
If PDF viewing is core to your app’s value, start with Nutrient. You’ll ship faster, support users better, and avoid the pain of migrating later. Teams that start with react-native-pdf often switch to Nutrient once they need annotations, forms, or signatures — and wish they’d made the switch earlier.
What you can build with Nutrient that you can’t with react-native-pdf
Production apps often need more than basic PDF viewing. Here’s what Nutrient enables that react-native-pdf doesn’t support:
1. Annotation support
- Limitations of
react-native-pdf—react-native-pdfonly renders annotations that were already in the source file. It doesn’t support annotation editing, so users won’t be able to create, update, or delete annotations in the PDF. - Nutrient SDK features — Nutrient’s React Native SDK supports comprehensive annotation capabilities, allowing you to add, edit, and remove various types of annotations programmatically or via the user interface. It supports 17 annotation types, including highlights, text, ink, notes, and shapes. You can also import and export annotations in XFDF or JSON formats, with advanced features like cloudy annotations and custom appearances.
2. Interactive PDF forms
- Limitations of
react-native-pdf—react-native-pdfonly renders forms and their values from the source file and doesn’t support form editing. Users won’t be able to fill forms in a PDF document. - Nutrient SDK features — Nutrient’s React Native SDK provides full support for interactive PDF forms, allowing users to fill, read, and edit PDF AcroForms programmatically or through the UI. You can capture form field data, export it, or embed it into the PDF.
3. Digital signatures
- Limitations of
react-native-pdf—react-native-pdfcurrently has no support for digital signatures, which are essential for verifying the authenticity of filled-out PDFs. - Nutrient SDK features — Nutrient React Native SDK includes support for adding electronic and digital signatures to PDF documents, ensuring a document’s authenticity.
4. Customizing the PDF viewer UI
- Limitations of
react-native-pdf— The customization options for the PDF viewer inreact-native-pdfare limited compared to the Nutrient SDK. - Nutrient SDK features — Nutrient offers extensive customization of the PDF viewer UI. You can modify the toolbar, adjust the background color, and configure the layout to match your app’s design. The viewer supports multiple page modes and transitions, ensuring the UI aligns with your app’s user experience.
5. Long-term support and updates
- Limitations of
react-native-pdf— The latest update forreact-native-pdfwas released in October 2020, and it has limited support for new features and updates. - Nutrient SDK features — The Nutrient SDK is regularly updated to add new features, fix bugs, and maintain compatibility with the latest React Native versions, operating system updates, and dependencies. This ensures your app stays up to date with the latest PDF handling capabilities.
Optimizing performance of the PDF viewer in React Native
To optimize the performance of the PDF viewer in React Native applications using Nutrient SDK, follow the best practices outlined below.
Optimize PDF documents
Before rendering, optimize your PDF documents for mobile viewing by reducing image sizes to save memory, avoiding JPEG 2000 for image compression due to its complexity, and using tools like Adobe Acrobat to optimize PDFs for mobile devices.
Implement caching
Improve performance for recurring users by implementing a caching strategy, such as using service workers to precache resources and implementing client-side caching for faster interactions.
Use Reader View
For text-heavy documents, consider using the Reader View feature, which presents content in an easy-to-read, single-column view optimized for mobile devices. It ignores non-essential elements like images and headers, improving reading flow and enhancing performance.
Configure page transitions
Optimize page transitions for smoother scrolling by using continuous scrolling modes, which ensure seamless navigation between pages.
Lazy loading
Consider implementing lazy loading techniques to load only the visible pages and their immediate neighbors, reducing memory usage and improving initial load times.
Optimize UI rendering
Customize the UI to show only necessary elements by hiding unnecessary toolbar buttons to reduce UI complexity and using the
PSPDFKitViewcomponent to adjust the layout of the native UI component for optimal performance.Use the latest version
Always use the latest version of Nutrient React Native SDK, as it likely includes performance improvements and bug fixes.
Apply these based on your document types and performance requirements.
Conclusion
In this tutorial, you saw how to integrate PDF viewing into a React Native app using both react-native-pdf and the Nutrient React Native PDF SDK. react-native-pdf is a solid choice for basic viewing in simple or internal apps, but it falls short when you need advanced features like annotations, interactive forms, digital signatures, or long-term support.
If your business depends on PDFs, it’s usually more efficient to adopt a dedicated React Native PDF viewer library like Nutrient from the start. We offer a commercial, feature-rich, and completely customizable React Native PDF SDK that’s easy to integrate and comes with well-documented APIs to handle advanced use cases. Check out our demos or start a free trial to see it in action.
If you have any questions about our Nutrient React Native SDK(opens in a new tab), please don’t hesitate to reach out to us(opens in a new tab). We’re happy to help!
FAQ
Two popular options are the open source react-native-pdf library and the commercial Nutrient React Native PDF SDK. react-native-pdf works well for basic PDF viewing, while Nutrient provides a full React Native PDF viewer with annotations, form filling, digital signatures, and long-term support — making it a better fit for production and enterprise apps.
react-native-pdf is an open source React Native library that lets you display PDF files in iOS and Android apps using a <Pdf /> component. It’s a good fit for simple, view-only React Native PDF viewers. For advanced features like annotations, form filling, and digital signatures, developers often switch to the Nutrient React Native PDF SDK.
You can display PDF files using either react-native-pdf or the Nutrient React Native PDF SDK. Both libraries expose React Native components that render PDFs on iOS and Android. In this tutorial, you install the dependencies, add a sample PDF to your project, and use the SDK’s viewer component to show the document in your app.
react-native-pdf can render existing annotations in a PDF but doesn’t support creating or editing them. For full annotation support — including adding, modifying, and deleting annotations from your React Native app — use the Nutrient React Native PDF SDK, which provides a robust annotation API and built-in UI tools.
Yes. While react-native-pdf displays form fields as they appear in a PDF, it doesn’t support interactive form filling. Nutrient React Native PDF SDK includes complete interactive form support, so users can fill out, validate, and submit PDF forms directly from your React Native PDF viewer.
Nutrient React Native PDF SDK gives you high-fidelity rendering, annotation editing, form filling, digital and electronic signatures, UI customization, performance optimizations, and ongoing updates for new React Native and OS versions. It’s designed as a production-ready React Native PDF viewer library rather than a basic renderer.
Install the @nutrient-sdk/react-native package, configure Android and iOS as shown in this tutorial, and then use the NutrientView component to load your PDF. To try it out in your own environment, start a free trial or explore the React Native SDK page.