[#11126] - Transparent images in PDFs genereted by Jasper/iText are shown as red rectangle in Adobe Reader on Android

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

Hello,
We're generating PDF Reports via JasperReports Framework (Version 6.3.1 with iText 2.1.7).
Recently we faced a problem with Adobe Reader on Android tablets: instead of the embedded images a ..red rectangle will be shown!

We noticed this problem for the first time with the Abrobat Reader Version 17.5.180092, and it still exists with the current version 18.2.0.182935.
(The Reader 17.0.* displays the PDFs correctly)
Displaying the same PDFs in Adobe Reader on all other platforms (Windows, iOS) with newest Reader Versions and with another PDF readers works without any problems.

A deeper investigation revealed that the reason is based on a transparent image, which was added by Jasper
(GIF loaded: net\sf\jasperreports\engine\images\pixel.GIF),
presumably used to position the image with user data.

On Android, the Acrobat Reader seems to display this image on top, in red color, and it obscures the graphic behind it.
In PDF editing tools (like Acrobat Pro) this transparent image can be captured and then moved, removed or set to background.
The PDF document looks fine in Adobe Reader on Android after this modification.

Is there any way to avoid this "behavior"?
Like forcing the transparent image to be invisible?
(Upgrading to newest version of Jasper: 6.6 didn't solve this problem)

We are grateful for any help.

--------------------
How we embed the graphics usually within jrxml:
<image scaleImage="RealSize">
<reportElement positionType="Float" x="0" y="27" width="609" height="50" backcolor="#FFFFFF"/>
<graphicElement>
<pen lineWidth="1.0"/>
</graphicElement>
<imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[$F{grafik}]]></imageExpression>
</image>

In Java we implemented a Renderer class as follows:
public class ReportGraphicRenderer extends AbstractRenderToImageDataRenderer {
@Override
public void render(JasperReportsContext jasperReportsContext, Graphics2D grx, Rectangle2D rectangle) {
// Do graphic operations
}
}

Christof

v6.3.1
ckux01's picture
2
Joined: Aug 22 2018 - 7:53am
Last seen: 6 months 3 days ago

1 Comment:

#1

Thanks to your brilliant analysis about pixel.gif I had the idea of replacing the gif with a png and that did the trick. So in my case I extended JrPDFExporter and overwrote getPxImage so that it returns a transparent PNG image.

Feedback
randomness