Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Using Barcodes with fonts #56

I am using jasperintegration version 2.4.0 , I have created a report with a font ( Font requires pdf encoding identity-H ), which in preview of jasperstudio shows barcodes. However the barcodes are not shown when report is compiled and used through jri, instead it shows normal text.

Can you please identify what am I doing wrong. Thank you

  • replies 13
  • views 651
  • likes 0
#2

Hi, version 2.4.0 is really old. You have to make sure to build reports using a version of jasperstudio that supports the old engine (JasperReports 6.4.1).

When you create a simple test report I can give it a try ... but I will try with the latest release.
The test report should work on a simple SQL Query like select '123' as dummy from dual ... or a query on the Oracle data dictionary like Select object_name from user_objects or something similar.

Thank you

#3

I have created report using Jasper 6.1.1 , the issue is that the barcodes are being generated when previewing inside JasperStudio. However when uploading it to jri the report is showing data of barcode instead of barcodes.

#4

ok, please provide a simplified test report, then I can have a look.

#5

In the simplest form the report has a textfield with a static text and font "code 128" ( which can be downloaded from https://www.dafont.com/code-128.font ) . When previewing report in jasper studio it is showing bar codes. However when using with jri it shows static text ( The font is available to jre )

#6

Well, then this seems to be a font issue ... not related to the two different barcode components that you can use in JasperReports.
Busy today ... might take a bit to build a testcase and try it.
Will get back to you.

#7

Ok , Thank you for the response.

Also when using barcode component with constant expression, instead of previous method I am getting below error when running with jri

Exception

javax.servlet.ServletException: Servlet execution threw an exception
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Root Cause

java.lang.NoClassDefFoundError: org/apache/xml/serializer/TreeWalker
	org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:818)
	net.sf.jasperreports.components.barcode4j.BarcodeSVGImageProducer.createImage(BarcodeSVGImageProducer.java:74)
	net.sf.jasperreports.components.barcode4j.AbstractBarcodeEvaluator.evaluateBarcodeRenderable(AbstractBarcodeEvaluator.java:98)
	net.sf.jasperreports.components.barcode4j.AbstractBarcodeEvaluator.visitCodabar(AbstractBarcodeEvaluator.java:194)
	net.sf.jasperreports.components.barcode4j.CodabarComponent.receive(CodabarComponent.java:44)
	net.sf.jasperreports.components.barcode4j.AbstractBarcodeEvaluator.evaluateBarcode(AbstractBarcodeEvaluator.java:85)
	net.sf.jasperreports.components.barcode4j.BarcodeFillComponent.evaluateBarcode(BarcodeFillComponent.java:83)
	net.sf.jasperreports.components.barcode4j.BarcodeFillComponent.evaluate(BarcodeFillComponent.java:70)
	net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:110)
	net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:381)
	net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:500)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2022)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:748)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
	net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582)
	net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
	net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:90)
	net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:286)
	de.oc.integration.jasper.webapp.ReportWrapper.service(Unknown Source)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Root Cause

java.lang.ClassNotFoundException: org.apache.xml.serializer.TreeWalker
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1352)
	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
	org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:818)
	net.sf.jasperreports.components.barcode4j.BarcodeSVGImageProducer.createImage(BarcodeSVGImageProducer.java:74)
	net.sf.jasperreports.components.barcode4j.AbstractBarcodeEvaluator.evaluateBarcodeRenderable(AbstractBarcodeEvaluator.java:98)
	net.sf.jasperreports.components.barcode4j.AbstractBarcodeEvaluator.visitCodabar(AbstractBarcodeEvaluator.java:194)
	net.sf.jasperreports.components.barcode4j.CodabarComponent.receive(CodabarComponent.java:44)
	net.sf.jasperreports.components.barcode4j.AbstractBarcodeEvaluator.evaluateBarcode(AbstractBarcodeEvaluator.java:85)
	net.sf.jasperreports.components.barcode4j.BarcodeFillComponent.evaluateBarcode(BarcodeFillComponent.java:83)
	net.sf.jasperreports.components.barcode4j.BarcodeFillComponent.evaluate(BarcodeFillComponent.java:70)
	net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:110)
	net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:381)
	net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:500)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2022)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:748)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
	net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
	net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582)
	net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
	net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:90)
	net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:286)
	de.oc.integration.jasper.webapp.ReportWrapper.service(Unknown Source)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
#8
#9

The other issue I cannot reproduce either.
I created a simple test case since you didn't provide one ... again.

Greenshot 2023-04-20 16.44.05.png

This one worked right off the bat without me doing anything ... but copying the Barcode4j.jrxml to the windows machine.
I used jri-2.10.1-jasper-6.20.0

I will attach the sample.

Good luck.

#10
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.19.1.final using JasperReports Library version 6.19.1-867c00bf88cd4d784d404379d6c05e1b419e8a4c  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Barcode4j" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a9a92cca-1036-45b1-9317-f3a9e323cc79">
	<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
	<property name="com.jaspersoft.studio.data.defaultdataadapter" value="dataadapters/win11-orclpdb-demo.jrdax"/>
	<queryString>
		<![CDATA[SELECT sysdate d,
	'123' symbol
FROM dual]]>
	</queryString>
	<field name="D" class="java.sql.Timestamp">
		<property name="com.jaspersoft.studio.field.name" value="D"/>
		<property name="com.jaspersoft.studio.field.label" value="D"/>
	</field>
	<field name="SYMBOL" class="java.lang.String">
		<property name="com.jaspersoft.studio.field.name" value="SYMBOL"/>
		<property name="com.jaspersoft.studio.field.label" value="SYMBOL"/>
	</field>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="79" splitType="Stretch"/>
	</title>
	<pageHeader>
		<band height="35" splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="30" splitType="Stretch">
			<staticText>
				<reportElement x="0" y="0" width="120" height="30" uuid="f11fb39a-0990-49a4-87db-c554541756d5">
					<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="b7994069-5229-4bb9-855f-d9ab43878c18"/>
				</reportElement>
				<text><![CDATA[D]]></text>
			</staticText>
			<staticText>
				<reportElement x="120" y="0" width="277" height="30" uuid="33a2caf6-729a-47c2-9f01-cd76fa0211c5">
					<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="c25cc5ed-3452-4204-b668-e6bba4250aa9"/>
				</reportElement>
				<text><![CDATA[SYMBOL]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="135" splitType="Stretch">
			<textField>
				<reportElement x="0" y="0" width="120" height="30" uuid="2ed46301-27cd-4c82-967f-70714d62392a">
					<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="b7994069-5229-4bb9-855f-d9ab43878c18"/>
				</reportElement>
				<textFieldExpression><![CDATA[$F{D}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="120" y="0" width="90" height="30" uuid="2f22d7d0-d16d-439a-ad6e-c825ac32c68a">
					<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="c25cc5ed-3452-4204-b668-e6bba4250aa9"/>
				</reportElement>
				<textFieldExpression><![CDATA[$F{SYMBOL}]]></textFieldExpression>
			</textField>
			<componentElement>
				<reportElement x="210" y="0" width="150" height="30" uuid="2baed5b7-9255-48fe-8a80-424221389d6b"/>
				<jr:Codabar xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
					<jr:codeExpression><![CDATA[$F{SYMBOL}]]></jr:codeExpression>
				</jr:Codabar>
			</componentElement>
		</band>
	</detail>
	<columnFooter>
		<band height="45" splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="54" splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band height="42" splitType="Stretch"/>
	</summary>
</jasperReport>
#11

Thank you for the detailed answer. I suppose then it might be an issue with the version of JRi I am using or the font issue in the Linux OS. WIll try it with new version of jri then post my results

#12

Hello

Sorry for a very late response, I tried your provided code with same JasperStudio version 6.19.1 and jri version jri-2.10.1-jasper-6.20.0. However only the barcode part is still not being visible when deploying to jri. It is being shown when previewing inside jasperstudio.

Is there a way to check what is happening , i.e. with any log etc. With this jasper version i am unable to find and logs

#13

After some more testing it seems that the issue is only happening when calling report from oracle apex application. When testing using test tool of jri the report seems to be rendering find

Any suggestions how can this issue be resolved

#14

So finally the issue is with the version of JRI. With new one it works. Thank you for providing detailed answers that was very helpful