Open PDF with expo

#1

Is there a way to open a pdf with expo not using Ejecting?

1 Like
#2

You could use PDF.js in a WebView or you could polyfill the renderer underneath it to render with Expo.GLView.

#3

If I could import pdfjs on my app… having some troubles with zlib

#4

I want to show a pdf from file-storage (without detaching).
With PDFjs it’s not possible due to zlib. @nikki, how can i do it with GLView ?

#5

I found a way using WebBrowser, on iOS you have a direct PDF reader and on android just prefix your PDF url with this: ‘https://drive.google.com/viewerng/viewer?embedded=true&url={your pdf url}’

2 Likes
[Android] Open pdf
#6

Hi,

Another solution I working on to display PDF with pdf.js and in a WebView:

#7

Will this work with files saved locally using expo’s FileSystem ?

#8

Yes it is

#9

I get “file props is required” alert:

<PdfReader file={this.props.uri} />

this.props.uri contains this value: “file:///Users/…/pdfs/25.pdf”.

Any ideas?

#10

Thanks for making this, can you tell me what I’m doing wrong? I’m also happy to dig in and help troubleshoot

#11

Hi @jogillesp,

Sorry I changed the API: https://github.com/xcarpentier/rn-pdf-reader-js#props
And add a check when uri include ‘file’.

#12

Hi x

I am trying to make use of the a file in assets, is this possible and what would be the syntax for this. So far I am getting an alert saying “source props is not correct”.

Thanks in advance.

Jiffa

#13

Hi @thejiff,

Sorry about that, can you please create an issue or maybe a PR :stuck_out_tongue: ?

Best regards,

1 Like
#14

it is not working on expo v31

#15

Hi, should be fixed in latest lib version v0.2.1!

1 Like
#16

@xcarpentier just tested out, it works just fine with the last Expo (no errors)…thank you so much!

2 Likes