Question

i am creating digital signature app using iTextG jar, to add water mark on the signature field, iText's

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

Requires a path of the watermark image, i want to use image from drawable folder of android, kindly suggest me i am not getting how to create Image instance from drawable, suggest if any other option is there?

Was it helpful?

Solution

You use ImageInstance something like this.

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

Hope this helped.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top