How to center align barcode using jasperreports and barcode4j
Asked Answered
B

1

6

I use iReport 5.5.0. How to center align a barcode component?

Relevant fragment of my jrxml is below.

        <componentElement>
            <reportElement x="0" y="9" width="113" height="36" uuid="a11badb4-7c31-4011-83ae-f287b457939a"/>
            <jr:Code128 xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" textPosition="bottom">
                <jr:codeExpression><![CDATA[$F{number}]]></jr:codeExpression>
            </jr:Code128>
        </componentElement>
Beefwood answered 21/4, 2014 at 15:34 Comment(0)
S
18

Create a style, let's call it "Barcode", like:

<style name="Barcode" fontName="Helvetica" fontSize="10" hAlign="Center" vAlign="Middle"/>

and set the style property of your barcode element to "Barcode".

Spiritualize answered 22/4, 2014 at 12:17 Comment(2)
Correct. But I use image alignment instead, <style name="Barcode" hImageAlign="Center" vImageAlign="Middle"/>.Stricklin
Hi what are the fonts supported?Desuetude

© 2022 - 2024 — McMap. All rights reserved.