Kishore
Kishore

Reputation: 2051

Inserting image in pdf android

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();

Upvotes: 3

Views: 5170

Answers (2)

kishore
kishore

Reputation: 19

You Can Do It Like this.It is working

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

Upvotes: 0

Kishore
Kishore

Reputation: 2051

solved...

Image image =Image.getInstance("sdcard/img.png");

Upvotes: 2

Related Questions