PDF reader for Expo
Android support 🚀
Read a PDF just with JS (no native libs needed)
Limitations
- Display file only on full screen.
- Embeded images binary are not display (yet) in Android
Example
Component { return <View style=stylescontainer> <PDFReader source= uri: 'http://gahp.net/wp-content/uploads/2017/09/sample.pdf' /> </View> } const styles = StyleSheet
Props
- source:
Object
- uri?:
string
- can be local or served on the web (ie. start withshttps://
orfile://
) - base64?:
string
- should start withdata:application/pdf;base64,
. A base64 encoded pdf file tends to start withJVBERi0xL
so your complete string should look soemthing like this:data:application/pdf;base64,JVBERi0xL...
- uri?:
- style:
object
- style props to override default container style - webviewStyle:
object
- style props to override default WebView style - onLoad:
func
- callback that runs after WebView is loaded - noLoader:
boolean
- show/hide the ActivityIndicator. Default is false
Requirements
- Use it into Expo app (from expo client, Standalone app or ExpoKit app).
- Because we need to have access to
Expo.FileSystem
- Only React-Native 0.54+ support, Expo SDK 27
Features
- For Android, use react-pdf / pdfjs in the webview
- For iOS devices, display file directly to the WebView
What rn-pdf-reader-js use?
- react-pdf (pdf.js)
- WebView
- Expo FileSystem API
- Base64
FAQ
Hire an expert!
Looking for a ReactNative freelance expert with more than 12 years experience? Contact me from my website!