react-native-doc-viewer icon indicating copy to clipboard operation
react-native-doc-viewer copied to clipboard

could not open the pdf in Android

Open HelenChenVIP opened this issue 7 years ago • 7 comments

"react-native": "^0.50.0", "react-native-doc-viewer": "^2.7.8", Unable to open PDF, directly crash, unable to display error.But the url changes to an image's address, the fileType changes to a JPG, and the image is displayed

 handlePress = (item) => {
    this.setState({animating: true});
    if(Platform.OS === 'ios'){
      OpenFile.openDoc([{
        url:"http://172.16.12.65:4064/webgrid_api/AppConfig/2018年1-4月上饶市空气质量分析报告.pdf",
        fileNameOptional:item.ReportName
      }], (error, url) => {
         if (error) {
          this.setState({animating: false});
         } else {
          this.setState({animating: false});
           console.log(url)
         }
       })
    }else{
      //Android
      this.setState({ animating: true });
      OpenFile.openDoc([{
          url: "http://172.16.12.65:4064/webgrid_api/AppConfig/2018年1-4月上饶市空气质量分析报告.pdf", // Local "file://" + filepath
          fileName: "sample",
          cache: false,
          fileType: "pdf"
      }], (error, url) => {
          if (error) {
              this.setState({ animating: false });
              console.error(error);
          } else {
              this.setState({ animating: false });
              console.log(url)
          }
      })
    }
  }

HelenChenVIP avatar Sep 04 '18 01:09 HelenChenVIP

Maybe you need install an third app which can view your document in your device.

waltChang1 avatar Sep 12 '18 10:09 waltChang1

我也碰到这个问题了! 请问您现在解决了吗?

ly-lewis avatar Sep 16 '18 12:09 ly-lewis

我也碰到这个问题了! 请问您现在解决了吗?

你需要咋你的设备上安装能打开文件的app,如 wps , Document viewer

waltChang1 avatar Sep 17 '18 01:09 waltChang1

也就是说 我现在在模拟器上是看不了的 谢谢啦 我现在试试

在 2018年9月17日,09:08,waltChang1 [email protected] 写道:

我也碰到这个问题了! 请问您现在解决了吗?

你需要咋你的设备上安装能打开文件的app,如 wps , Document viewer

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/philipphecht/react-native-doc-viewer/issues/119#issuecomment-421865100, or mute the thread https://github.com/notifications/unsubscribe-auth/Abb_EvychK_HxCZDfL9IdWxrZLGpVnw3ks5ubvYIgaJpZM4WYLHC.

ly-lewis avatar Sep 17 '18 01:09 ly-lewis

How do you make it so the file opens in the 3rd party app? Ive installed WPS but when I try to open the file it crashes my app.

k3j123 avatar Sep 17 '18 16:09 k3j123

@waltChang1 in my phone i have wps ,word ,and so on... But i can not open the pdf, its crash

HelenChenVIP avatar Nov 09 '18 07:11 HelenChenVIP

@ly-lewis @waltChang1 anybody can help me ?thanks

HelenChenVIP avatar Nov 16 '18 01:11 HelenChenVIP