0

バーコードやbarcode4jにはあまり詳しくありません。バーコードの URL があり、その URL に接続し、それをストリーミングして画像を作成し、その画像をファイル システムのどこかに保存する必要があります。

Barcode4Jでこれを行った経験のある人はいますか?

以下にURLを作成します...

private BarcodeRequestBean barCodeProcess(ResponseWithBarCode barCode)throws Exception
{
    //hard coding bar code encoding and font size time being
    String barCodeNum = ((ResponseWithBarCode)barCode).getBarCodeNumber();
    logger.info("Please check below barcode generating parameters if generation failed:");
    logger.info("BarCode Number     = " + barCodeNum);

    if (StringUtils.isEmpty(barCodeNum)||(barCodeNum==null))
    {
        throw new Exception("ResponseWithBarCode returned invalid barCodeNumber value!");
    }
    BarcodeRequestBean barbean = new BarcodeRequestBean();

    //set bar code number
    barbean.setMsg(barCodeNum);                                                 //reference number

    //set default value
    barbean.setType(config.getString("barcode.encoding"));                      //ex:code128
    barbean.setHumanReadableSize(config.getString("barcode.font.size"));        //ex:3pt
    barbean.setWideFactor(config.getString("barcode.wide.factor"));             //wide factor: 2
    barbean.setFormat(config.getString("barcode.file.format"));                 //file format: png
    barbean.setHeight(config.getString("barcode.height"));                      //heigh:1cm
    barbean.setModuleWidth(config.getString("barcode.module.width"));           //Module width: 0.15mm
    return barbean;
}

私はそのようなURLの文字列を持っています:

String genbc = barCodeProcess(barCode).toURL();
4

1 に答える 1