Q: I’m trying to save a filled form in PDFViewCtrlDemo on Android, but I got a message that the file has an invalid path: “File has an invalid path; cannot save”.
A: When you run the PDFViewCtrlDemo it loads by default a file located in the raw folder of the project. This file is accessed using an InputStream:
Resources rs = getResources(); InputStream fis = rs.openRawResource(R.raw.sample); doc = new PDFDoc(fis);
When you click the “Save” button, the demo tries to save the file using the same name (overwriting the file). Since this file was opened using an InputStream, the doc object does not have the information of the file name, thus the condition will fail in this case. Try using a file located on your device (somewhere in /mnt/sdcard), or just change a bit the code for saving the file in PDFViewCtrlDemo, method onOptionsItemSelected.