|
29 | 29 | import net.sf.jasperreports.engine.export.HtmlExporter; |
30 | 30 | import net.sf.jasperreports.engine.export.JRCsvExporter; |
31 | 31 | import net.sf.jasperreports.engine.export.JRPdfExporter; |
| 32 | +import net.sf.jasperreports.engine.export.PdfGlyphRenderer; |
32 | 33 | import net.sf.jasperreports.export.*; |
33 | 34 |
|
34 | 35 | import java.awt.font.GlyphVector; |
@@ -193,23 +194,30 @@ private JasperPrint createEmptyReport() { |
193 | 194 | } |
194 | 195 |
|
195 | 196 | private void configurePdfGlyphRendering(final JasperPrint print) { |
196 | | - warnIfPdfGlyphRenderingUnsupported(); |
| 197 | + logPdfGlyphRenderingSupport(); |
197 | 198 | print.setProperty(PDF_GLYPH_RENDERER_BLOCKS_PROPERTY, PDF_GLYPH_RENDERER_BLOCKS); |
198 | 199 | print.setProperty(PdfReportConfiguration.PROPERTY_GLYPH_RENDERER_ADD_ACTUAL_TEXT, Boolean.TRUE.toString()); |
199 | 200 | } |
200 | 201 |
|
201 | | - private void warnIfPdfGlyphRenderingUnsupported() { |
| 202 | + private void logPdfGlyphRenderingSupport() { |
202 | 203 | try { |
203 | 204 | com.lowagie.text.pdf.PdfContentByte.class.getMethod("showText", GlyphVector.class); |
| 205 | + final URL source = getPdfContentByteSource(); |
| 206 | + LOG.info("PDF glyph rendering support detected. Jasper supported=" |
| 207 | + + PdfGlyphRenderer.supported() |
| 208 | + + ", iText source=" + source); |
204 | 209 | } catch (final NoSuchMethodException ex) { |
205 | | - final URL source = com.lowagie.text.pdf.PdfContentByte.class.getProtectionDomain().getCodeSource() == null |
206 | | - ? null |
207 | | - : com.lowagie.text.pdf.PdfContentByte.class.getProtectionDomain().getCodeSource().getLocation(); |
208 | 210 | LOG.warning("PDF glyph rendering is disabled because the loaded iText jar does not support " |
209 | | - + "PdfContentByte.showText(GlyphVector): " + source); |
| 211 | + + "PdfContentByte.showText(GlyphVector): " + getPdfContentByteSource()); |
210 | 212 | } |
211 | 213 | } |
212 | 214 |
|
| 215 | + private URL getPdfContentByteSource() { |
| 216 | + return com.lowagie.text.pdf.PdfContentByte.class.getProtectionDomain().getCodeSource() == null |
| 217 | + ? null |
| 218 | + : com.lowagie.text.pdf.PdfContentByte.class.getProtectionDomain().getCodeSource().getLocation(); |
| 219 | + } |
| 220 | + |
213 | 221 | /** |
214 | 222 | * Fills the report using the parameters and JR data source. |
215 | 223 | * |
|
0 commit comments