could not open the pdf in Android
"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)
}
})
}
}
Maybe you need install an third app which can view your document in your device.
我也碰到这个问题了! 请问您现在解决了吗?
我也碰到这个问题了! 请问您现在解决了吗?
你需要咋你的设备上安装能打开文件的app,如 wps , Document viewer
也就是说 我现在在模拟器上是看不了的 谢谢啦 我现在试试
在 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.
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.
@waltChang1 in my phone i have wps ,word ,and so on... But i can not open the pdf, its crash
@ly-lewis @waltChang1 anybody can help me ?thanks