PDF Reader
Android support 🚀
Read a PDF just with JS (no native libs needed)
Requirements
- 👉Install react-native-webview on your own!
- 👉Install expo-file-system on your own!
- 👉Install expo-constants on your own!
- Use it into Expo app (from expo client, Standalone app or ExpoKit app).
- Only React-Native 0.59-0.60+ support, Expo SDK 33-36+
PRs are welcome...
Example
import * as React from 'react'
import { View } from 'react-native'
import PDFReader from 'rn-pdf-reader-js'
export default class App extends React.Component {
render() {
return (
<PDFReader
source={{
uri: 'http://gahp.net/wp-content/uploads/2017/09/sample.pdf',
}}
/>
)
}
}
See more detailed example into App.tsx
file.
Props
interface Source {
uri?: string
base64?: string
headers?: { [key: string]: string }
}
interface Props {
source: Source
style?: View['props']['style']
webviewStyle?: WebView['props']['style']
webviewProps?: WebView['props']
noLoader?: boolean
useGoogleReader?: boolean
withScroll?: boolean
withPinchZoom?: boolean
customStyle?: {
readerContainer?: CSS.Properties
readerContainerDocument?: CSS.Properties
readerContainerNumbers?: CSS.Properties
readerContainerNumbersContent?: CSS.Properties
readerContainerZoomContainer?: CSS.Properties
readerContainerZoomContainerButton?: CSS.Properties
readerContainerNavigate?: CSS.Properties
readerContainerNavigateArrow?: CSS.Properties
}
onLoad?(): void
onLoadEnd?(): void
onError?(): void
}
Possibilities
Render type | Platform | Source prop |
---|
Custom PDF reader | Android | uri or base64 |
Direct from WebView | iOS | uri or base64 |
Google PDF Reader | Android, iOS | uri |
What rn-pdf-reader-js use?
- react-pdf (pdf.js)
- WebView
- Base64
FAQ
Hire an expert!
Looking for a ReactNative freelance expert with more than 12 years experience? Contact me from my website!