react-native-android-pdfview

## Getting started

Usage no npm install needed!

<script type="module">
  import reactNativeAndroidPdfview from 'https://cdn.skypack.dev/react-native-android-pdfview';
</script>

README

react-native-react-native-android-pdfview

Getting started

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

dependencies "react-native": "^0.41.2 ",

Mostly automatic installation

$ react-native link react-native-android-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-android-pdfview and add RNReactNativeAndroidPdfview.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNReactNativeAndroidPdfview.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.RNReactNativeAndroidPdfviewPackage; to the imports at the top of the file
  • Add new RNReactNativeAndroidPdfviewPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native--android-pdfview'
    project(':react-native-android-pdfview').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-android-pdfview/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-android-pdfview')
    

Windows

Read it! :D

  1. In Visual Studio add the RNReactNativeAndroidPdfview.sln in node_modules/react-native-android-pdfview/windows/RNReactNativeAndroidPdfview.sln folder to their solution, reference from their app.
  2. Open up your MainPage.cs app
  • Add using React.Native.Android.Pdfview.RNReactNativeAndroidPdfview; to the usings at the top of the file
  • Add new RNReactNativeAndroidPdfviewPackage() to the List<IReactPackage> returned by the Packages method

Usage

import RNReactNativeAndroidPdfview from 'react-native-react-native-android-pdfview';

RNAndroidPdfView:
load pdf  usage : 
uri:  you need send the PDF file's name 
<RNAndroidPdfView uri={"moby.pdf"}  style={{width:Dimensions.get('window').width,height:Dimensions.get('window').height}}/>
url:
<RNAndroidPdfView 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 
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
into  Mainfest............


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  <mainfest  />
add   tools:replace="android:allowBackup"  in  <application  />