public static BarcodeGenerator createBarcode4J( final String type, final boolean showText, final boolean checksum, final Number barHeight) { if (BARCODE_DATAMATRIX.equals(type)) { final DataMatrix dataMatrix = new DataMatrix(); return dataMatrix; } if (BARCODE_EAN8.equals(type)) { final EAN8 dataMatrix = new EAN8(); if (showText == false) { dataMatrix.getUPCEANBean().setMsgPosition(HumanReadablePlacement.HRP_NONE); } if (barHeight != null) { dataMatrix.getUPCEANBean().setBarHeight(UnitConv.pt2mm(barHeight.doubleValue())); } dataMatrix .getUPCEANBean() .setChecksumMode(checksum ? ChecksumMode.CP_AUTO : ChecksumMode.CP_IGNORE); return dataMatrix; } if (BARCODE_EAN128.equals(type)) { final EAN128 dataMatrix = new EAN128(); if (showText == false) { dataMatrix.getEAN128Bean().setMsgPosition(HumanReadablePlacement.HRP_NONE); } if (barHeight != null) { dataMatrix.getEAN128Bean().setBarHeight(UnitConv.pt2mm(barHeight.doubleValue())); } dataMatrix .getEAN128Bean() .setChecksumMode(checksum ? ChecksumMode.CP_AUTO : ChecksumMode.CP_IGNORE); return dataMatrix; } if (BARCODE_UPCE.equals(type)) { final UPCE dataMatrix = new UPCE(); if (showText == false) { dataMatrix.getUPCEANBean().setMsgPosition(HumanReadablePlacement.HRP_NONE); } if (barHeight != null) { dataMatrix.getUPCEANBean().setBarHeight(UnitConv.pt2mm(barHeight.doubleValue())); } dataMatrix .getUPCEANBean() .setChecksumMode(checksum ? ChecksumMode.CP_AUTO : ChecksumMode.CP_IGNORE); return dataMatrix; } if (BARCODE_ROYALMAIL.equals(type)) { final RoyalMailCBC dataMatrix = new RoyalMailCBC(); if (showText == false) { dataMatrix.getRoyalMailCBCBean().setMsgPosition(HumanReadablePlacement.HRP_NONE); } if (barHeight != null) { dataMatrix.getRoyalMailCBCBean().setBarHeight(UnitConv.pt2mm(barHeight.doubleValue())); } dataMatrix .getRoyalMailCBCBean() .setChecksumMode(checksum ? ChecksumMode.CP_AUTO : ChecksumMode.CP_IGNORE); return dataMatrix; } if (BARCODE_USPSINTELLIGENTMAIL.equals(type)) { final USPSIntelligentMail dataMatrix = new USPSIntelligentMail(); if (showText == false) { dataMatrix.getUSPSIntelligentMailBean().setMsgPosition(HumanReadablePlacement.HRP_NONE); } if (barHeight != null) { dataMatrix .getUSPSIntelligentMailBean() .setBarHeight(UnitConv.pt2mm(barHeight.doubleValue())); } dataMatrix .getUSPSIntelligentMailBean() .setChecksumMode(checksum ? ChecksumMode.CP_AUTO : ChecksumMode.CP_IGNORE); return dataMatrix; } return null; }