How to use barcodes in JasperReport?










0















I want to show on my JasperRepost one EAN13 barcode. I have the 13 digit input in the field list for it (SQL query is also OK), but in JasperSoft Studio 6.6.0 the "Barcode" element in the Palette doesn't seem to work with drag-and-drop (doesn't do anything sadly...).
So... I went into the source view and made some Google searches, how the barcode element should look like and found this:



<componentElement>
<reportElement x="0" y="100" width="200" height="50" 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[$FEAN]]></c:codeExpression>
</c:barbecue>
</componentElement>


But, this also doesn't seem to be okay, because I got this error if I want to preview it:



net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:114)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.setBarcodeImage(BarbecueFillComponent.java:142)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.fill(BarbecueFillComponent.java:111)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.fill(JRFillComponentElement.java:198)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1039)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:469)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:417)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillFixedBand(JRHorizontalFiller.java:2553)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillDetail(JRHorizontalFiller.java:853)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReportStart(JRHorizontalFiller.java:264)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReport(JRHorizontalFiller.java:116)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.sourceforge.barbecue.BarcodeException: Invalid data length
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.ean.EAN13Barcode.<init>(Unknown Source)
at net.sourceforge.barbecue.BarcodeFactory.createEAN13(Unknown Source)
at net.sf.jasperreports.components.barbecue.BarcodeProviders$EAN13Provider.createBaseBarcode(BarcodeProviders.java:241)
at net.sf.jasperreports.components.barbecue.BaseBarcodeProvider.createBarcode(BaseBarcodeProvider.java:40)
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:110)
... 13 more


Wat could be the problem? Invalid data length? My test barcode value is this actually: 6941057402314, exactly 13 digits long. This value is stored in the db as VARCHAR, could this be the problem?



EDIT.:



Ok, I found out that this is maybe a Barbecue issue: Babrbecue Exception but this is 10 years old...



Thank you.










share|improve this question
























  • I don't understand... what is the problem with my question? Why are you voting for "close"?

    – VORiAND
    Nov 15 '18 at 10:03















0















I want to show on my JasperRepost one EAN13 barcode. I have the 13 digit input in the field list for it (SQL query is also OK), but in JasperSoft Studio 6.6.0 the "Barcode" element in the Palette doesn't seem to work with drag-and-drop (doesn't do anything sadly...).
So... I went into the source view and made some Google searches, how the barcode element should look like and found this:



<componentElement>
<reportElement x="0" y="100" width="200" height="50" 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[$FEAN]]></c:codeExpression>
</c:barbecue>
</componentElement>


But, this also doesn't seem to be okay, because I got this error if I want to preview it:



net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:114)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.setBarcodeImage(BarbecueFillComponent.java:142)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.fill(BarbecueFillComponent.java:111)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.fill(JRFillComponentElement.java:198)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1039)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:469)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:417)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillFixedBand(JRHorizontalFiller.java:2553)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillDetail(JRHorizontalFiller.java:853)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReportStart(JRHorizontalFiller.java:264)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReport(JRHorizontalFiller.java:116)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.sourceforge.barbecue.BarcodeException: Invalid data length
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.ean.EAN13Barcode.<init>(Unknown Source)
at net.sourceforge.barbecue.BarcodeFactory.createEAN13(Unknown Source)
at net.sf.jasperreports.components.barbecue.BarcodeProviders$EAN13Provider.createBaseBarcode(BarcodeProviders.java:241)
at net.sf.jasperreports.components.barbecue.BaseBarcodeProvider.createBarcode(BaseBarcodeProvider.java:40)
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:110)
... 13 more


Wat could be the problem? Invalid data length? My test barcode value is this actually: 6941057402314, exactly 13 digits long. This value is stored in the db as VARCHAR, could this be the problem?



EDIT.:



Ok, I found out that this is maybe a Barbecue issue: Babrbecue Exception but this is 10 years old...



Thank you.










share|improve this question
























  • I don't understand... what is the problem with my question? Why are you voting for "close"?

    – VORiAND
    Nov 15 '18 at 10:03













0












0








0








I want to show on my JasperRepost one EAN13 barcode. I have the 13 digit input in the field list for it (SQL query is also OK), but in JasperSoft Studio 6.6.0 the "Barcode" element in the Palette doesn't seem to work with drag-and-drop (doesn't do anything sadly...).
So... I went into the source view and made some Google searches, how the barcode element should look like and found this:



<componentElement>
<reportElement x="0" y="100" width="200" height="50" 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[$FEAN]]></c:codeExpression>
</c:barbecue>
</componentElement>


But, this also doesn't seem to be okay, because I got this error if I want to preview it:



net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:114)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.setBarcodeImage(BarbecueFillComponent.java:142)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.fill(BarbecueFillComponent.java:111)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.fill(JRFillComponentElement.java:198)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1039)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:469)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:417)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillFixedBand(JRHorizontalFiller.java:2553)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillDetail(JRHorizontalFiller.java:853)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReportStart(JRHorizontalFiller.java:264)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReport(JRHorizontalFiller.java:116)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.sourceforge.barbecue.BarcodeException: Invalid data length
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.ean.EAN13Barcode.<init>(Unknown Source)
at net.sourceforge.barbecue.BarcodeFactory.createEAN13(Unknown Source)
at net.sf.jasperreports.components.barbecue.BarcodeProviders$EAN13Provider.createBaseBarcode(BarcodeProviders.java:241)
at net.sf.jasperreports.components.barbecue.BaseBarcodeProvider.createBarcode(BaseBarcodeProvider.java:40)
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:110)
... 13 more


Wat could be the problem? Invalid data length? My test barcode value is this actually: 6941057402314, exactly 13 digits long. This value is stored in the db as VARCHAR, could this be the problem?



EDIT.:



Ok, I found out that this is maybe a Barbecue issue: Babrbecue Exception but this is 10 years old...



Thank you.










share|improve this question
















I want to show on my JasperRepost one EAN13 barcode. I have the 13 digit input in the field list for it (SQL query is also OK), but in JasperSoft Studio 6.6.0 the "Barcode" element in the Palette doesn't seem to work with drag-and-drop (doesn't do anything sadly...).
So... I went into the source view and made some Google searches, how the barcode element should look like and found this:



<componentElement>
<reportElement x="0" y="100" width="200" height="50" 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[$FEAN]]></c:codeExpression>
</c:barbecue>
</componentElement>


But, this also doesn't seem to be okay, because I got this error if I want to preview it:



net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode.
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:114)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.setBarcodeImage(BarbecueFillComponent.java:142)
at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.fill(BarbecueFillComponent.java:111)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.fill(JRFillComponentElement.java:198)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1039)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:469)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:417)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillFixedBand(JRHorizontalFiller.java:2553)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillDetail(JRHorizontalFiller.java:853)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReportStart(JRHorizontalFiller.java:264)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReport(JRHorizontalFiller.java:116)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.sourceforge.barbecue.BarcodeException: Invalid data length
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source)
at net.sourceforge.barbecue.linear.ean.EAN13Barcode.<init>(Unknown Source)
at net.sourceforge.barbecue.BarcodeFactory.createEAN13(Unknown Source)
at net.sf.jasperreports.components.barbecue.BarcodeProviders$EAN13Provider.createBaseBarcode(BarcodeProviders.java:241)
at net.sf.jasperreports.components.barbecue.BaseBarcodeProvider.createBarcode(BaseBarcodeProvider.java:40)
at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:110)
... 13 more


Wat could be the problem? Invalid data length? My test barcode value is this actually: 6941057402314, exactly 13 digits long. This value is stored in the db as VARCHAR, could this be the problem?



EDIT.:



Ok, I found out that this is maybe a Barbecue issue: Babrbecue Exception but this is 10 years old...



Thank you.







java jasper-reports barcode barbecue






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 10:26







VORiAND

















asked Nov 14 '18 at 14:00









VORiANDVORiAND

3682922




3682922












  • I don't understand... what is the problem with my question? Why are you voting for "close"?

    – VORiAND
    Nov 15 '18 at 10:03

















  • I don't understand... what is the problem with my question? Why are you voting for "close"?

    – VORiAND
    Nov 15 '18 at 10:03
















I don't understand... what is the problem with my question? Why are you voting for "close"?

– VORiAND
Nov 15 '18 at 10:03





I don't understand... what is the problem with my question? Why are you voting for "close"?

– VORiAND
Nov 15 '18 at 10:03












1 Answer
1






active

oldest

votes


















0














As it turned out the EAN13 barcode is actually 12 digits long, the 13th digit is calculated. So if I changed it to 12 digits, the barcode is generated.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53301998%2fhow-to-use-barcodes-in-jasperreport%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As it turned out the EAN13 barcode is actually 12 digits long, the 13th digit is calculated. So if I changed it to 12 digits, the barcode is generated.






    share|improve this answer



























      0














      As it turned out the EAN13 barcode is actually 12 digits long, the 13th digit is calculated. So if I changed it to 12 digits, the barcode is generated.






      share|improve this answer

























        0












        0








        0







        As it turned out the EAN13 barcode is actually 12 digits long, the 13th digit is calculated. So if I changed it to 12 digits, the barcode is generated.






        share|improve this answer













        As it turned out the EAN13 barcode is actually 12 digits long, the 13th digit is calculated. So if I changed it to 12 digits, the barcode is generated.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 13:01









        VORiANDVORiAND

        3682922




        3682922





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53301998%2fhow-to-use-barcodes-in-jasperreport%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3

            Museum of Modern and Contemporary Art of Trento and Rovereto