1.1.2 • Published 4 years ago

@aimawari/react-native-pdfview v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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 --save

Then add maven { url "https://jitpack.io" } to repositories inside android/build.gradle

allprojects {
    repositories {
       	...
        maven { url "https://jitpack.io" }
    }
}

Manual installation

  • Add import com.aimawari.pdfview.PdfviewPackage; to the imports at the top of the file
  • Add new PdfviewPackage() to the list returned by the getPackages() method
  1. 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')
  2. 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

Note

  • IOS below than 11 currenly can't render annotation and get table of contents