【问题标题】:Inserting image in pdf android在pdf android中插入图像
【发布时间】:2012-06-11 06:59:55
【问题描述】:

如何使用DroidText 在 pdf 中添加图像我尝试了以下代码 -

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

【问题讨论】:

  • 您遇到了哪个错误?,请同时发布您的 logcat
  • pdf 生成的内容为空。

标签: android pdf-generation android-droidtext


【解决方案1】:

解决了……

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

【讨论】:

    【解决方案2】:

    你可以这样做。它正在工作

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-05
      • 2021-05-27
      • 2014-08-25
      相关资源
      最近更新 更多