1.0.1 • Published 7 years ago

react-native-jf-pdfview v1.0.1

Weekly downloads
10
License
-
Repository
-
Last release
7 years ago

react-native-jf-pdfview

Getting started

$ npm install react-native--jf-pdfview --save

Mostly automatic installation

$ react-native link react-native-jf-pdfview

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-jf-pdfview and add RNReactNativeJfPdfview.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNReactNativeJfPdfview.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNReactNativeJfPdfviewPackage; to the imports at the top of the file
  • Add new RNReactNativeJfPdfviewPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-jf-pdfview'
    project(':react-native-jf-pdfview').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-jf-pdfview/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-jf-pdfview')

Usage

import {JRNPdfView} from 'react-native-jf-pdfview';

load pdf usage :

uri: you need send the PDF file's name

<JRNPdfview uri={"moby.pdf"} style={{width:Dimensions.get('window').width,height:Dimensions.get('window').height}}/> url:默认水平方向滑动翻页 ,如果你想垂直方向滑动翻页 使用 vurl属性

<JRNPdfView url={"url"} style={{width:Dimensions.get('window').width,height:Dimensions.get('window').height}}/>

if you want to get the PDF from intent and get the complete state ,

Usage :

componentDidMount() { this.listener = null; if (Platform.OS === 'ios') { //todo } else { this.listener = DeviceEventEmitter.addListener("complete", (result) => { this.showAlert("获取到加载结束的通知" + result); //result is a boolean : true }); } }

if you want the RNAndroidPdfView work ,please add

At last : if an error occurred liked "Mainfest merge failed" ,you need add some things like down: add xmlns:tools="http://schemas.android.com/tools" in add tools:replace="android:allowBackup" in