Open PDF with expo

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

1 Like

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

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

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 ?

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

Hi,

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

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

Yes it is

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?

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

Hi @jogillesp,

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

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

1 Like

Hi @thejiff,

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

Best regards,

1 Like

it is not working on expo v31

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

1 Like

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

2 Likes

but its too slow