Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

📄 PDF reader in JavaScript only for Expo - Android & iOS capable

License

NotificationsYou must be signed in to change notification settings

xcarpentier/rn-pdf-reader-js

Repository files navigation

Android support 🚀





npm versionnpm downloads

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*asReactfrom'react'import{View}from'react-native'importPDFReaderfrom'rn-pdf-reader-js'exportdefaultclassAppextendsReact.Component{render(){return(<PDFReadersource={{uri:'http://gahp.net/wp-content/uploads/2017/09/sample.pdf',}}/>)}}

See more detailed example intoApp.tsx file.

Props

interfaceSource{uri?:string// can be local or served on the web (ie. start with `https://` or `file://`)base64?:string// should start with `data:application/pdf;base64,`. A base64 encoded pdf file tends to start with `JVBERi0xL` so your complete string should look something like this: `data:application/pdf;base64,JVBERi0xL...`headers?:{[key:string]:string}}interfaceProps{source:Sourcestyle?:View['props']['style']// style props to override default container stylewebviewStyle?:WebView['props']['style']// style props to override default WebView stylewebviewProps?:WebView['props']noLoader?:booleanuseGoogleReader?:boolean// If you are not worried about confidentialitywithScroll?:boolean// Can cause performance issuewithPinchZoom?:booleancustomStyle?:{readerContainer?:CSS.PropertiesreaderContainerDocument?:CSS.PropertiesreaderContainerNumbers?:CSS.PropertiesreaderContainerNumbersContent?:CSS.PropertiesreaderContainerZoomContainer?:CSS.PropertiesreaderContainerZoomContainerButton?:CSS.PropertiesreaderContainerNavigate?:CSS.PropertiesreaderContainerNavigateArrow?:CSS.Properties}onLoad?():void// callback that runs after WebView is loadedonLoadEnd?():void// callback that runs after WebView is loadedonError?():void// callback that runs when WebView is on error}

Possibilities

Render typePlatformSource prop
Custom PDF readerAndroiduri or base64
Direct from WebViewiOSuri or base64
Google PDF ReaderAndroid, iOSuri

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!

About

📄 PDF reader in JavaScript only for Expo - Android & iOS capable

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors17


[8]ページ先頭

©2009-2025 Movatter.jp