如何解决只读文件系统错误在Android编程与eclipse [英] how to solve read only file system error in android programming with eclipse
本文介绍了如何解决只读文件系统错误在Android编程与eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我用来创建pdf文件的代码,但是发生错误
/ Image.pdf:打开失败:EROFS(只读文件系统)
这是我的按钮点击代码:
Document document = new Document();
PdfWriter.getInstance(document,new FileOutputStream(Image.pdf));
document.open();
Image image1 = Image.getInstance(watermark.png);
document.add(image1);
String imageUrl =http://jenkov.com/images/20081123-20081123-3E1W7902-small-portrait.jpg;
Image image2 = Image.getInstance(new URL(imageUrl));
document.add(image2);
document.close();
解决方案
尝试在sdcard根目录中写pdf: p>
PdfWriter.getInstance(document,new FileOutputStream(Environment.getExternalStorageDirectory()。getAbsolutePath()+Image.pdf));
I am developing a program in which i must create pdf file inside application.
This is the code that i use for creating pdf file but an error occurred that say
"/Image.pdf:open failed:EROFS(read-only file system)"
This is my button click code:
Document document = new Document();
PdfWriter.getInstance(document,new FileOutputStream("Image.pdf"));
document.open();
Image image1 = Image.getInstance("watermark.png");
document.add(image1);
String imageUrl = "http://jenkov.com/images/20081123-20081123-3E1W7902-small-portrait.jpg";
Image image2 = Image.getInstance(new URL(imageUrl));
document.add(image2);
document.close();
解决方案
Try to write pdf in sdcard root directory:
PdfWriter.getInstance(document,new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath()+"Image.pdf"));
这篇关于如何解决只读文件系统错误在Android编程与eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文