【问题标题】:Creating Image instance from drawable images in android从android中的可绘制图像创建图像实例
【发布时间】:2014-02-10 04:25:08
【问题描述】:

我正在使用iTextG jar 创建数字签名应用程序,在签名字段上添加水印,iText 的

appearance.setImage(Image.getInstance(signedImagePath));

需要水印图像的路径,我想使用android的drawable文件夹中的图像,请建议我没有得到如何从drawable创建图像实例,建议是否有其他选项?

【问题讨论】:

    标签: android itext signature


    【解决方案1】:

    你使用 ImageInstance 这样的东西。

     Bitmap bitmap = BitmapFactory.decodeResource(getBaseContext().getResources(),R.drawable.yourimage);
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100 , stream);
        Image myImg = Image.getInstance(stream.toByteArray());
    

    希望这会有所帮助。

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多