Skip to content

Commit cabf7b4

Browse files
committed
update pom for jaspersoft
1 parent e826b79 commit cabf7b4

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

api/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@
781781
<artifactId>itext</artifactId>
782782
<version>2.1.8.js8</version>
783783
<packaging>jar</packaging>
784-
<file>${basedir}/lib/itext-4.2.1.jar</file>
784+
<file>${basedir}/lib/itext-2.1.7.js7.jar</file>
785785
</configuration>
786786
</execution>
787787
<execution>
@@ -795,7 +795,7 @@
795795
<artifactId>itext</artifactId>
796796
<version>2.1.7.js8</version>
797797
<packaging>jar</packaging>
798-
<file>${basedir}/lib/itext-4.2.1.jar</file>
798+
<file>${basedir}/lib/itext-2.1.7.js7.jar</file>
799799
</configuration>
800800
</execution>
801801
</executions>

api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/jasper/impl/JasperReportImpl.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
import net.sf.jasperreports.engine.export.JRPdfExporter;
3232
import net.sf.jasperreports.export.*;
3333

34+
import java.awt.font.GlyphVector;
3435
import java.io.ByteArrayOutputStream;
3536
import java.io.IOException;
3637
import java.io.InputStream;
38+
import java.net.URL;
3739
import java.util.Arrays;
3840
import java.util.Collection;
3941
import java.util.Map;
@@ -191,10 +193,23 @@ private JasperPrint createEmptyReport() {
191193
}
192194

193195
private void configurePdfGlyphRendering(final JasperPrint print) {
196+
warnIfPdfGlyphRenderingUnsupported();
194197
print.setProperty(PDF_GLYPH_RENDERER_BLOCKS_PROPERTY, PDF_GLYPH_RENDERER_BLOCKS);
195198
print.setProperty(PdfReportConfiguration.PROPERTY_GLYPH_RENDERER_ADD_ACTUAL_TEXT, Boolean.TRUE.toString());
196199
}
197200

201+
private void warnIfPdfGlyphRenderingUnsupported() {
202+
try {
203+
com.lowagie.text.pdf.PdfContentByte.class.getMethod("showText", GlyphVector.class);
204+
} 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+
LOG.warning("PDF glyph rendering is disabled because the loaded iText jar does not support "
209+
+ "PdfContentByte.showText(GlyphVector): " + source);
210+
}
211+
}
212+
198213
/**
199214
* Fills the report using the parameters and JR data source.
200215
*

0 commit comments

Comments
 (0)