I am creating an app and I want to save a report with pdf. From what I have seen the itext library is a good choice. I have the problem when creating the document because it returns an error:
open failed: EROFS (Read-only file system)
The code I use is:
Document document = new Document();
File prueva = new File(getExternalFilesDir(null), "prueva.pdf");
try {
PdfWriter.getInstance(document, new FileOutputStream(prueva));
} catch (DocumentException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
document.open();
In manifest I have added permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Any ideas? Thank you very much!