A PDF viewer for Expo with React Native

Viewed 1440
2 Answers

rn-pdf-reader-js seems to be not working for the expo 38+. You can try this fork instead:

https://github.com/stratoss/rn-pdf-reader-js

Just import it as import PDFReader from '@bildau/rn-pdf-reader' and you are good to go.

"rn-pdf-reader-js": "^4.1.1"
"expo": "^40.0.0"

The library work just fine for me in their latest version the only issue comes around that the base64 contain octet-stream so i replace it with pdf like that:

   setBase64(reader.result.replace("octet-stream", "pdf"))

and pass it to the source like that:

 <PdfReader
   source={{
     base64: base64,
     }}
  />

I hope this helps you. otherwise, please provide us more details about so we can help.

Related