{"id":25629258,"url":"https://github.com/PSPDFKit/react-native","last_synced_at":"2025-02-22T19:17:22.611Z","repository":{"id":48264411,"uuid":"64770659","full_name":"PSPDFKit/react-native","owner":"PSPDFKit","description":"React Native library for PSPDFKit for iOS, Android and Windows UWP.","archived":false,"fork":false,"pushed_at":"2024-12-13T14:22:35.000Z","size":35867,"stargazers_count":138,"open_issues_count":33,"forks_count":74,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-02-18T17:50:38.710Z","etag":null,"topics":["android","ios","pdf-document","pspdfkit","react-native","xcode"],"latest_commit_sha":null,"homepage":"https://pspdfkit.com/blog/2016/react-native-module/","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PSPDFKit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-02T15:49:39.000Z","updated_at":"2024-12-13T14:22:37.000Z","dependencies_parsed_at":"2024-03-22T17:54:13.353Z","dependency_job_id":"1282834a-6a67-4c75-83ea-2adb8eab5ac2","html_url":"https://github.com/PSPDFKit/react-native","commit_stats":{"total_commits":765,"total_committers":23,"mean_commits":33.26086956521739,"dds":0.6758169934640523,"last_synced_commit":"6592f8f58f980439c95e95136805f82886a9bf61"},"previous_names":[],"tags_count":151,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Freact-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Freact-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Freact-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Freact-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PSPDFKit","download_url":"https://codeload.github.com/PSPDFKit/react-native/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240222477,"owners_count":19767460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","pdf-document","pspdfkit","react-native","xcode"],"created_at":"2025-02-22T19:17:08.886Z","updated_at":"2025-02-22T19:17:22.604Z","avatar_url":"https://github.com/PSPDFKit.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Nutrient React Native SDK\n\n![Nutrient React Native SDK](https://github.com/PSPDFKit/react-native/blob/master/article-header.png?raw=true)\n\nThis library requires a valid license of the Nutrient SDK. Licenses are per platform.\n\nThe Nutrient React Native SDK exposes the most often used APIs from Nutrient. Many of our partners end up forking this repository and adding some custom code to achieve even greater integration with their products, using native code.\n\nWindows is not currently supported, please use version [1.24.9](https://github.com/PSPDFKit/react-native/releases/tag/1.24.9) instead.\n\n### Nutrient\n\nThe [Nutrient SDK](https://nutrient.io/) is a framework that allows you to view, annotate, sign, and fill PDF forms on iOS, Android, Windows, macOS, and Web.\n\n[Nutrient Collaboration ](https://www.nutrient.io/sdk/solutions/collaboration) adds real-time collaboration features to seamlessly share, edit, and annotate PDF documents.\n\n# Support, Issues and License Questions\n\nNutrient offers support for customers with an active SDK license via https://support.nutrient.io/hc/en-us/requests/new.\n\nAre you evaluating our SDK? That's great, we're happy to help out! The Nutrient React Native  SDK is a commercial product and requires the purchase of a license key when used in production. By default, this library will initialize in demo mode, placing a watermark on each PDF and limiting usage to 60 minutes.\n\nTo purchase a license for production use, please reach out to us via https://www.nutrient.io/sdk/contact-sales.\n\nTo initialize the Nutrient React Native SDK using a license key, call either of the following before using any other Nutrient SDK APIs or features:\n\nTo set the license key for both Android and iOS, use:\n\n```\nPSPDFKit.setLicenseKeys('YOUR_REACT_NATIVE_ANDROID_LICENSE_KEY_GOES_HERE', 'YOUR_REACT_NATIVE_IOS_LICENSE_KEY_GOES_HERE');\n```\n\nTo set the license key for the currently running platform, use:\n\n```\nPSPDFKit.setLicenseKey('YOUR_REACT_NATIVE_LICENSE_KEY_GOES_HERE');\n```\n\n### Requirements\n\n- A [development environment](https://reactnative.dev/docs/environment-setup) for running React Native projects using the React Native CLI. If you’re using Expo, [check out our blog post](https://www.nutrient.io/blog/how-to-use-pspdfkit-for-react-native-with-expo/) on the topic.\n\n#### iOS\n\n- The [latest stable version of Xcode](https://apps.apple.com/us/app/xcode/id497799835?mt=12)\n- The [latest stable version of CocoaPods](https://github.com/CocoaPods/CocoaPods/releases). If you don’t already have CocoaPods installed, follow the [CocoaPods installation guide](https://guides.cocoapods.org/using/getting-started.html#installation) to install CocoaPods on your Mac.\n\n#### Android\n\n- The [latest stable version of Android Studio](https://developer.android.com/studio)\n- The [Android NDK](https://developer.android.com/studio/projects/install-ndk)\n- An [Android Virtual Device](https://developer.android.com/studio/run/managing-avds.html) or a hardware device\n\n### Installation\n\nThe Nutrient React Native SDK dependency is installed from the GitHub repository and not the `npm` registry. To install the Nutrient React Native SDK, run `yarn add react-native-pspdfkit@github:PSPDFKit/react-native` in your project directory or `npm install github:PSPDFKit/react-native` if you’re using `npm`.\n\n### Getting Started\n\nSee our [Getting Started on React Native guide](https://www.nutrient.io/getting-started/react-native/?react-native-platform=android-ios\u0026project=new-project) to integrate the SDK into your new or existing application, or follow the steps below:\n\n1. In the terminal app, change the current working directory to the location you wish to save your project. In this example, we’ll use the `~/Documents` directory:\n\n   ```bash\n   cd ~/Documents\n   ```\n\n1. Create the React Native project by running the following command:\n\n   ```bash\n   npx react-native init PSPDFKitDemo\n   ```\n\n1. In the terminal app, change the location of the current working directory inside the newly created project:\n\n   ```bash\n   cd PSPDFKitDemo\n   ```\n\n1. Add the Nutrient React Native SDK:\n\n   ```bash\n   yarn add react-native-pspdfkit@github:PSPDFKit/react-native\n   ```\n\n1. Install all the dependencies for the project:\n\n   ```bash\n   yarn install\n   ```\n\n1. Open your project's `build.gradle` file:\n\n   ```bash\n   open android/build.gradle\n   ```\n\n1. Add the Nutrient repository to download the Nutrient SDK:\n\n    ```diff\n      allprojects {\n        repositories {\n          mavenLocal()\n    +       maven {\n    +         url 'https://my.nutrient.io/maven/'\n    +       }\n        }\n      }\n    ```\n\n1. Open the app’s build.gradle file:\n\n    ```diff\n    ...\n      android {\n    -  compileSdkVersion rootProject.ext.compileSdkVersion\n    +  compileSdkVersion 34\n    ...\n      defaultConfig {\n        applicationId \"com.pspdfkitdemo\"\n    -     minSdkVersion rootProject.ext.minSdkVersion\n    +     minSdkVersion 21\n          targetSdkVersion rootProject.ext.targetSdkVersion\n          versionCode 1\n          versionName \"1.0\"\n      }\n    }\n    ...\n    ```\n\n1. Open your project’s Podfile:\n\n   ```bash\n   open ios/Podfile\n   ```\n\n1. Update the minimum iOS platform version in the Podfile:\n\n    ```diff\n    ...\n    - platform :ios, min_ios_version_supported\n    + platform :ios, '15.0'\n    ...\n    ```\n\n1. Change the location of the current working directory to the `ios` folder:\n\n   ```bash\n   cd ios\n   ```\n\n1. Install the CocoaPods dependencies:\n\n   ```bash\n   pod install\n   ```\n\n1. Open your project’s Workspace in Xcode:\n\n   ```bash\n   open PSPDFKitDemo.xcworkspace\n   ```\n\n1. Make sure the deployment target is set to 15.0 or higher:\n\n   ![deployment-target](./screenshots/deployment-target.png)\n\n1. Change View controller-based status bar appearance to `YES` in your project’s `Info.plist`:\n\n   ![view-controller-based-status-bar-appearance](./screenshots/view-controller-based-status-bar-appearance.png)\n\n1. Add the PDF document you want to display to your application by dragging it into your project. On the dialog that’s displayed, select Finish to accept the default integration options. You can use \u003ca href=\"https://www.nutrient.io/downloads/pspdfkit-ios-quickstart-guide.pdf\" download=\"Document.pdf\"\u003ethis QuickStart Guide PDF\u003c/a\u003e as an example.\n\n   ![drag-and-drop-document](./screenshots/drag-and-drop-document.png)\n\n1. Change the location of the current working directory back to the root project folder:\n\n   ```bash\n   cd ..\n   ```\n\n1. Create the `assets` directory:\n\n   ```bash\n   mkdir android/app/src/main/assets\n   ```\n\n1. Copy a PDF document into your Android assets directory:\n\n   ```bash\n   cp ~/Downloads/Document.pdf android/app/src/main/assets/Document.pdf\n   ```\n\n1. Open your `App.tsx` file:\n\n   ```bash\n   open App.tsx\n   ```\n\n1. Replace the entire contents of `App.tsx` with the following code snippet:\n\n    ```typescript\n    import React, {Component} from 'react';\n    import {Platform} from 'react-native';\n    import PSPDFKitView from 'react-native-pspdfkit';\n    import { NativeModules } from 'react-native';\n\n    const PSPDFKit = NativeModules.PSPDFKit;\n    PSPDFKit.setLicenseKey(null);\n\n    const DOCUMENT =\n      Platform.OS === 'ios' ? 'Document.pdf' : 'file:///android_asset/Document.pdf';\n    export default class PSPDFKitDemo extends Component\u003c{}\u003e {\n      render() {\n        var pdfRef: React.RefObject\u003cPSPDFKitView\u003e = React.createRef();\n        return (\n          \u003cPSPDFKitView\n            document={DOCUMENT}\n            configuration={{\n              showThumbnailBar: 'scrollable',\n              pageTransition: 'scrollContinuous',\n              scrollDirection: 'vertical',\n            }}\n            ref={pdfRef}\n            fragmentTag=\"PDF1\"\n            style={{flex: 1}}\n          /\u003e\n        );\n      }\n    }\n    ```\n\n1. The app is now ready to launch! Go back to the terminal app and run:\n\n   ```bash\n   react-native run-ios\n   ```\n\n   ```bash\n   react-native run-android\n   ```\n\n### Running the example Catalog application\n\nTake a look at the instructions to get started [here](/samples/Catalog/README.md#running-this-sample-on-ios) for iOS and [here](/samples/Catalog/README.md#running-this-sample-on-android) for Android.\n\n### Configuration\n\nThe behaviour of the `PSPDFKitView` component can be customized using the configuration object. Refer to the [`PDFConfiguration`](https://www.nutrient.io/api/react-native/PDFConfiguration.html) API documentation. The `PDFConfiguration` object can be passed as parameter in when creating the `PSPDFKitView` component, or when using the `PSPDFKit.present()` Native Module API.\n\n```typescript\nconst configuration: PDFConfiguration = {\n  showPageLabels: false,\n  pageTransition: 'scrollContinuous',\n  scrollDirection: 'vertical',\n  showThumbnailBar: 'scrollable'\n};\n```\n\n## Updates\n\nSome releases contain changes that require updates to your project settings or application code. Take a look at our [Upgrade and Migration guides](https://www.nutrient.io/guides/react-native/upgrade/) after updating your Nutrient React Native SDK dependency.\n\n# Troubleshooting\n\nFor Troubleshooting common issues you might encounter when setting up the Nutrient React Native SDK, please refer to the [Troubleshooting](https://www.nutrient.io/guides/react-native/troubleshoot/) section.\n\n## License\n\nThis project can be used for evaluation or if you have a valid Nutrient license.\nAll items and source code Copyright © 2010-2024 PSPDFKit GmbH.\n\nSee [LICENSE](./LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPSPDFKit%2Freact-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPSPDFKit%2Freact-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPSPDFKit%2Freact-native/lists"}