I am trying to draw the transparent png onto the Pdf using PdfBoxGraphics2D.
I am using PdfBox version - 2.0.28
pdfBoxGraphics2D.drawImage(image, transform, null);
and I am overriding the encodeImage() method of PdfBoxGraphics2DLosslessImageEncoder as below
pdImageXObject = LosslessFactory.createFromImage(document, bufferedImage);
if (imageKey != null) {
((PdfResourceCache) document.getResourceCache()).addImageToCache(imageKey, pdImageXObject);
}
and we are seeing transparent PNG images appear in PDFs with gray halo around the edges like below. Any help on the fix is greatly appreciated.
and here are the transparent png images I am trying draw onto the pdf.
and


