问题
Q: Why is the alpha information lost when saving to PDF?
Jaspersoft studio doesn't allow me to specify colors with alpha. So I tried to be clever and specified keys on my shading elements and changed the color in the code like so:
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(getClass().getResourceAsStream("/reports/Test.jasper"));
((JRStaticText) jasperReport.getGroups()[0].getGroupHeaderSection().getBands()[0].getElementByKey("bg")).setBackcolor(new Color(0, 0, 0, 30));
((JRRectangle) jasperReport.getGroups()[0].getGroupFooterSection().getBands()[0].getElementByKey("bg")).setBackcolor(new Color(0, 0, 0, 30));
Just to see if it makes a difference I used both JRStaticText and JRRectangle. The preview and the physical printout on paper look great. It also works when I print to PDFCreator. But when I save to PDF from the JRViewer/JasperViewer, the resulting PDF appears with opaque black.
Preview/Paper print/PDFCreator:

Jasper reports PDF save/export:

回答1:
Apparently this feature is not supported by Jasper Reports.
Jasper Studio 6.1 even allows to specify a Text field transparency level in the background color dialog box, only to lose the value as soon as the dialog is given the OK.
The solution we implemented was to overlap the text with a semi-transparent image prepared previously.
来源:https://stackoverflow.com/questions/29458133/semi-transparent-translucent-background-color-ignored-in-jasper-reports-pdf-ex