
Once and: Pdfviewer wont read file from storage downloads react native
AMAZON VIDEO DOWNLOAD TO PC | 405 |
KANOJO X KANOJO X KANOJO EP 1-3 FREE DOWNLOAD | 812 |
CURSOR DOWNLOADS WINDOWS 10 | 955 |
LARAVEL 5.4 DOCUMENTATION PDF DOWNLOAD | 945 |
RITTZ IN MY ZONE FREE MP3 DOWNLOAD | 343 |
npm
Library for displaying PDF documents in react-native
- android - uses Android PdfViewer. Targets minSdkVersion 21 (required by setClipToOutline) and above.. By default stable version is used. It's also possible to override it and use (this version allows to handle links, etc. and will be used when Android PdfViewer stable version is released). To change the version, define it in your build file:
ios - uses WKWebView. Targets iOS9.0 and above
zero NPM dependencies
Getting started
Linking
From RN 0.60 there is no need to link - Native Modules are now Autolinked
Mostly automatic installation
If it doesn't work follow the official react native documentation
Using CocoaPods
In your Xcode project directory open Podfile and add the following line:
And install:
Android
- Open up
- Add to the imports at the top of the file
- Add to the list returned by the method
- Append the following lines to :
- Insert the following lines inside the dependencies block in :
Note for Android
The Android project tries to retrieve the following properties:
- compileSdkVersion
- buildToolsVersion
- minSdkVersion
- targetSdkVersion
from the object if you have one defined in your Android's project root (you can read more about it here). If not, it falls back to its current versions (check the gradle file for additional information).
Windows
ReactWindows
N/A
Demo
Android | iOS |
---|---|
![]() | ![]() |
Quick Start
Use the demo project to:
- Test the component on both android and iOS
- Render PDF using URL, BASE64 data or local file
- Handle error state
Props
Name | Android | iOS | Description |
---|---|---|---|
resource | ✓ | ✓ | A resource to render. It's possible to render PDF from , or |
resourceType | ✓ | ✓ | Should correspond to resource and can be: , or |
fileFrom | ✗ | ✓ | iOS ONLY: In case if is set to , there are different way to search for it on iOS file system. Currently , , and are supported. |
onLoad | ✓ | ✓ | Callback that is triggered when loading is completed |
onError | ✓ | ✓ | Callback that is triggered when loading has failed. And error is provided as a function parameter |
style | ✓ | ✓ | A style |
fadeInDuration | ✓ | ✓ | Fade in duration (in ms, defaults to 0.0) to smoothly fade the webview into view when pdf loading is completed |
enableAnnotations | ✓ | ✗ | Android ONLY: Boolean to enable Android view annotations (default is false). |
urlProps | ✓ | ✓ | Extended properties for type that allows to specify HTTP Method, HTTP headers and HTTP body |
onPageChanged | ✓ | ✗ | Callback that is invoked when page is changed. Provides and information |
onScrolled | ✓ | ✓ | Callback that is invoked when PDF is scrolled. Provides value in a range between 0 and 1. Currently only 0 and 1 are supported. |
Methods
Allows to reload the PDF document. This can be useful in such cases as network issues, document is expired, etc. To reload the document you will need a to the component:
And trigger it by calling :
Or check the demo project which also includes this functionality.
Development tips
On android for the type it is required to request permissions to read/write. You can get more information in PermissionsAndroid section from react native or Request App Permissions from android documentation. Demo project provides an example how to implement it using Java, check the MainActivity.java and AndroidManifest.xml files.
Before trying type in demo project, open folder in and store some document that you want to render.
On iOS, when using resource you can specify where to look for the file with . If you do not pass any value, the component will lookup in two places. First, it will attempt to locate the file in the Bundle. If it cannot locate it there, it will search the Documents directory. For more information on the iOS filesystem access at runtime of an application please refer the official documentation. Note here that the resource will always need to be a relative path from the Documents directory for example and also do NOT put the scheme in the path (so no ).
You can find an example of both usage of the Bundle and Documents directory for rendering a pdf from on iOS in the demo project.
In demo project you can also run the simple server to serve PDF file. To do this navigate to and start the server . (Do not forget to set proper IP adress of the server in )
License
MIT
-
-
-