0

By using webview, I am able to show pdf in iOS, but in android it always shows white screen.

I am using webview to show pdf in my mobile app. In iOS it works fine but in android, it keep on showing white screen. I know there are some packages like react-native-pdf which can do this, but I want to do it through webview. Is it possible if yes then how?

     <WebView
         source={require('./android/app/src/main/myPdf.pdf')}
      />

It should show pdf in android app, but it is showing white screen everytime.

Zabih Ullah
  • 575
  • 5
  • 14
  • Move your pdf file to android/app/src/main/assets or android/app/src/main/assets/pdf . Also see this answer https://stackoverflow.com/a/35925218/1848929 – hakki May 20 '19 at 09:09
  • As I said, I know it could be possible through `react-native-pd`, but I want to do it with simple webview. Moreover my pdf is already in `android/app/src/main/assets` – Zabih Ullah May 20 '19 at 09:31

1 Answers1

0

Via Webview (Android) is not possible to embed a "./...pdf" URL directly.

You can load the PDF in an external PDF manager (ex. Google Docs) and use that URL.