I am using this code to generate pdf file in android but it gives me "File not found exception"
try {
OutputStream file = new FileOutputStream(new File("D:\\Test.pdf"));
Document document = new Document();
// PdfWriter.getInstance(document, new FileOutputStream(FILE));
PdfWriter.getInstance(document, file);
document.open();
addMetaData(document);
addTitlePage(document);
addContent(document);
//createImage();
document.close();
} catch (Exception e) {
e.printStackTrace();
}
when I execute this line:
PdfWriter.getInstance(document, file);
It says "Java.io.FileNotFOundException". I have to create new file then why is it open a file which is not even generated yet? what is wrong with this code?