3

How to add image in a pdf using DroidText I have tried the following code -

Document document = new Document();
File f=new File(Environment.getExternalStorageDirectory(), "SimpleImages.pdf");
PdfWriter.getInstance(document,new FileOutputStream(f));
document.open();
document.add(new Paragraph("Simple Image"));

Image image =Image.getInstance("file:///mnt/sdcard/img.png");
document.add(image);
document.close();
Kishore
  • 2,051
  • 5
  • 26
  • 45

2 Answers2

2

solved...

Image image =Image.getInstance("sdcard/img.png");
Kishore
  • 2,051
  • 5
  • 26
  • 45
0

You Can Do It Like this.It is working

Image image = Image.getInstance ("file:///mnt/sdcard/Wallpapers/i_love_you.jpg"); document.add(image);

kishore
  • 19
  • 1
  • 8