2

I want to show on my Jasper Report one EAN13 barcode WITH text. So far the preview in JasperSoft Studio 6.5.1 is working great, I see the barcode and the text under it:

preview in JasperSoft Studio

This is the code part of it:

    <componentElement>
        <reportElement positionType="FixRelativeToBottom" x="0" y="111" width="130" height="30" uuid="48d9d636-7e04-43df-9fa2-5c3f6edf27da"/>
        <c:barbecue xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="EAN13" drawText="true" checksumRequired="false">
            <c:codeExpression><![CDATA[$F{EAN}]]></c:codeExpression>
        </c:barbecue>
    </componentElement>

My problem is, that if I build this .jasper report and deploy is to my Java webapp and print it out into one .pdf the text under the barcode is empty or white, but I see there nothing, only the barcode.

empty text under barcode

What do I need to change to view the text also in the webapp version of the report? Thank you.

EDIT.:

I got this answer on the Jaspersoft forum:

"It's not really a problem with JasperReports but with Barbeque. There's a bug in calculating the text area size. Fixing barbeque and replacing it in JasperReports solved the problem for me. "

Sadly I'm not closer to solve the issue, because I tried to resize the barcode element to the possible maximum, but nothing changed...

VORiAND
  • 145
  • 3
  • 17
  • 35
  • Looks like a font issue. Did you try to use different fonts? Did you try to use font extensions? – Alex K Nov 15 '18 at 17:56
  • I don't know how to change the font sadly in JasperSoft Studio... Can I do this via source code? Font extension is new to me, can you send me a description about it? – VORiAND Nov 15 '18 at 19:34
  • [Use custom fonts when creating pdf using iReport](https://stackoverflow.com/q/8985497/876298) & [When export a report to PDF change the font](https://stackoverflow.com/q/19232826/876298) – Alex K Nov 15 '18 at 19:43
  • `Can I do this via source code?` - Yes. You can set font at *jrxml* file (direct or with help of style) – Alex K Nov 15 '18 at 19:47
  • Can you please post example, how to set font for this barbecue element? I can't find any setting regarding the fonts in the properties and also couldn't find anything for the source code :( The other elements have Dejavu Sant fonts and they are displayed in the pdf without any error. – VORiAND Nov 15 '18 at 20:07
  • Okay, defined one style and applied to this element. Changed the font, font size... Nothing changed :( – VORiAND Nov 16 '18 at 16:35
  • What is a value of `$F{EAN}`? How to test this issue? – Alex K Nov 16 '18 at 17:35
  • Value of the test ean is: 694105740231. I can send you the whole .jrxml is that helps :) – VORiAND Nov 16 '18 at 21:35
  • I uploaded it to Pastebin: https://pastebin.com/X6WQq0m1 – VORiAND Nov 16 '18 at 21:51
  • Your sample is working well for me - I checked at JSS – Alex K Nov 17 '18 at 15:27
  • <![CDATA["694105740231"]]> – Alex K Nov 17 '18 at 15:28
  • Looks like really font problem. I'll try from Java code – Alex K Nov 17 '18 at 15:29
  • I have Glassfish as server, but if you got the barcode AND the text, then I don't know what I am missing... – VORiAND Nov 17 '18 at 15:29
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/183823/discussion-between-alex-k-and-voriand). – Alex K Nov 17 '18 at 15:30
  • All other reports using this DejavuSans font as well and they are printed without any errors. But I will try this font extension as well, maybe... – VORiAND Nov 17 '18 at 15:30
  • We observed this happens with the Barbecue component when the JVM is started with the -Djava.awt.headless=true property. I'm afraid this is a Barbecue bug we cannot fix, so we suggest to use the Barcode4J component instead. – Teodor Danciu Dec 21 '19 at 10:14

0 Answers0