I am developing an app using the itext library.
When I access one of my images hosted in the drawable folder, it is not copied correctly. It is a logo, and it has a transparent part. When included in the document, the background (what is transparent) becomes black. So the image does include it, but with the black background.
This is my code:
Drawable d = getResources ().getDrawable (R.drawable.logopeq223);
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] bitmapData = stream.toByteArray();
Image imageLogo = Image.getInstance(bitmapData);
imageLogo.scaleAbsolute(70,40);
imageLogo.setAlignment(Element.ALIGN_RIGHT);
document.add(imageLogo);