[英]error in opening pdf file in android,
My project in android use html file to navigate pages, and there is a link that will open a pdf file. 我在android中的项目使用html文件导航页面,并且有一个链接可以打开pdf文件。
here is the html code for the html : 这是html的html代码:
<a href="#" onClick="window.jsinterface.pdf1Click();" style="font-size: 0.9em; padding: 3px 7px 2px 7px; font-family:serif; color:white; text-decoration: none;">My PDF</a>
and this is the code for in my src. 这是我的src中的代码。
public void pdf1Click() {
handler.post(new Runnable() {
public void run() {
ReadWriteDisplayPDFFile(getResources().openRawResource(R.raw.pdf1),"pdf1.pdf");
}
});
}
but when I run my project and click to the link to open the pdf file, it can't open the pdf file and i got this error: 但是,当我运行我的项目并单击链接以打开pdf文件时,它无法打开pdf文件,并且出现此错误:
Error Writting on /sdcard/myproj/pdf1.pdf
Please Inserd SD Card
and 和
No Application available to view pdf
does anyone have an Idea about my case? 有人对我的案子有想法吗? thanks in advance
提前致谢
logcat: 日志猫:
Error writing /sdcard/myproj/pdf1.pdf
java.io.FileNotFoundException: /sdcard/myproj/pdf1.pdf : open failed: EACCES (Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
at com.sample.AppActivity$JSInterface.ReadWriteDisplayPDFFile(AppActivity.java:146)
START {act=android.intent.action.VIEW dat=file:///sdcard/myproj/pdf1.pdf typ=application/pdf flg=0x4000000 u=0} from pid 626
Please see below Stack overflow's answer for read pdf using pdfviewer library, it may help you and if you have any query regarding that then tell me. 请参阅下面关于使用pdfviewer库读取pdf的Stack溢出的答案,它可能对您有帮助,如果您对此有任何疑问,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.