0

Here is my code. It's working well, but in my android phone there is no pdf file. It shows path storage/emulated/0pdfcc.pdf in toast message, but in my phone there is no file like this.
What can I do?
Thanks in advance

public void PdfCreate(View view){
    Toast.makeText(this,"1",Toast.LENGTH_SHORT).show();
    try {
        Toast.makeText(this,"2",Toast.LENGTH_SHORT).show();
        // File root=Environment.getExternalStorageDirectory();
        //File directory=new File(root.getAbsolutePath()+"createPDF.pdf");
        String path = Environment.getExternalStorageDirectory()
                                 .getAbsolutePath() + "/pdfcc.pdf";
        Toast.makeText(this," not done" +path,Toast.LENGTH_SHORT).show();

        PdfWriter.getInstance(document,new FileOutputStream(path));
        document.open();
        document.add(new Paragraph(text.getText().toString()));
        document.close();

        Toast.makeText(this,"done",Toast.LENGTH_SHORT).show();
    } catch (DocumentException e) {
        e.printStackTrace();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
}
barbsan
  • 3,418
  • 11
  • 21
  • 28

0 Answers0