@aimawari/react-native-pdfview
v1.1.2
Published
A react native pdf viewer component
Downloads
31
Maintainers
Readme
React Native PDFView
A react native pdf viewer component
Getting started
$ npm install rn-fetch-blob aimawari/react-native-zoomable-view --save
$ npm install @aimawari/react-native-pdfview --saveThen add maven { url "https://jitpack.io" } to repositories inside android/build.gradle
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}$ cd ios && pod install$ react-native link rn-fetch-blob
$ react-native link @aimawari/react-native-pdfviewPlease add this to your android/app/build.gradle
android {
+ packagingOptions {
+ pickFirst 'lib/x86/libc++_shared.so'
+ pickFirst 'lib/x86_64/libjsc.so'
+ pickFirst 'lib/arm64-v8a/libjsc.so'
+ pickFirst 'lib/arm64-v8a/libc++_shared.so'
+ pickFirst 'lib/x86_64/libc++_shared.so'
+ pickFirst 'lib/armeabi-v7a/libc++_shared.so'
+ }
}Manual installation
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜@aimawari➜react-native-pdfviewand addPdfview.xcodeproj - In XCode, in the project navigator, select your project. Add
libPdfview.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.aimawari.pdfview.PdfviewPackage;to the imports at the top of the file - Add
new PdfviewPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':@aimawari_react-native-pdfview' project(':@aimawari_react-native-pdfview').projectDir = new File(rootProject.projectDir, '../node_modules/@aimawari_react-native-pdfview/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:implementation project(':@aimawari_react-native-pdfview')
Usage
import Pdfview from '@aimawari/react-native-pdfview';
export default const PDFExample = () => {
return (
<Pdfview
horizontal
enablePaging
page={1}
source={{
uri:
'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
}}
password=""
onLoadComplete={(numberOfPages, path, size, toc) => {}}
onPageChanged={(page, numberOfPages) => {}}
onError={error => {}}
onPageSingleTap={(page) => {}}
style={{flex: 1, backgroundColor: 'transparent'}}
/>
);
};Changelog
ANDROID
- Change pdf render plugin to use my folk.
IOS
- Add pdfKit support (ios >= 11)
Note
- IOS below than 11 currenly can't render
annotationand gettable of contents
