7

I want to open a pdf file that was previous downloaded and storaged in phone.

local url file: file:///var/mobile/Containers/Data/Application/ ... more url ... /example.pdf

I am using Expo library to open in Android:

if (Platform.OS !== 'ios') {
    FileSystem.getContentUriAsync(pdfLocalUrl).then((cUri) => {
      IntentLauncher.startActivityAsync('android.intent.action.VIEW', {
        data: cUri.uri,
        flags: 1,
        type: 'application/pdf',
      });
    });
  }

I dont find yeat a way to open in ios. webView and linking.OpenUrl not found because need a valid web url.

Linking.openURL(pdfLocalUrl);

webView with gdoc not work too:

renderPdfOffline = () => {
const html = 'https://drive.google.com/viewerng/viewer?embedded=true&url=';
return (
  <WebView
    style={{ flex: 1 }}
    scalesPageToFit={true}
    source={{
      uri: html + this.state.pdfUrl,
    }}
  ></WebView>
);

};

0 Answers0