Menu

#34 text below

open
nobody
None
5
2020-04-29
2010-02-27
No

Hi, thank you for your work!.
When you use barbecue on Linux (Centos 5, Ubuntu) is not possible to drawing text below the barcode.
I set Barcode.setDrawingText(true).
Have You any idea?
Thank you
Angelo

Discussion

  • Brill Pappin

    Brill Pappin - 2010-12-06

    Same problem here on Ubuntu server 10.10.

     
  • Ersin Erol

    Ersin Erol - 2020-04-29

    I am not sure but from my report design experiences, I think that's because of some fonts of the font package of barbecue may not exist in some linux versions.
    In windows, text is drawn normally below the barcode.
    I had a workaround by dividing barcode text to 4 and place them over the below part of barcode in iReport. Just have a look at image I attached.
    My example is EAN-13 type barcode.

    First part is the 1st number of the barcode text:
    $P{BARKOD_NO}==null ? "" : $P{BARKOD_NO}.substring(0, 1)

    Second part is continued 6 numbers:
    $P{BARKOD_NO}==null ? "" : $P{BARKOD_NO}.substring(1, 7)

    Third part is continued 5 numbers:
    $P{BARKOD_NO}==null ? "" : $P{BARKOD_NO}.substring(7, $P{BARKOD_NO}.length())

    Last part is check digit number :
    $P{BARKOD_NO}==null ? "" : ($P{CHECKDIGIT}==null ? "" : $P{CHECKDIGIT})

    Parameter name that all 12 numbers in text passed to iReport tool by parameter from code is $P{BARKOD_NO} but, last number is $P{CHECKDIGIT} parameter calculated from barcode API.
    and this $P{CHECKDIGIT} have a code exactly like this :

    ~~~
    private int checkDigit(long barcodeNumber) {
    int oddSum = 0, evenSum = 0, bigSum;
    boolean odd = true;
    while (barcodeNumber != 0) {
    if (odd) {
    oddSum += barcodeNumber % 10;
    odd = false;
    } else {
    evenSum += barcodeNumber % 10;
    odd = true;
    }
    barcodeNumber = (barcodeNumber - barcodeNumber % 10) / 10;
    }

    oddSum *= 3;
    bigSum = oddSum + evenSum;
    int modSum = bigSum % 10;
    if (modSum == 0) {
        modSum = 10;
    }
    return 10 - modSum;
    

    }

    In democracy, remedies are inexhaustible. HAVE FUN !

     

    Last edit: Ersin Erol 2020-04-29

Log in to post a comment.

MongoDB Logo MongoDB