当前位置: 首页>>代码示例>>Java>>正文


Java HumanReadablePlacement类代码示例

本文整理汇总了Java中org.krysalis.barcode4j.HumanReadablePlacement的典型用法代码示例。如果您正苦于以下问题:Java HumanReadablePlacement类的具体用法?Java HumanReadablePlacement怎么用?Java HumanReadablePlacement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HumanReadablePlacement类属于org.krysalis.barcode4j包,在下文中一共展示了HumanReadablePlacement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: barCode

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
public PaymentPdfBuilder barCode(final String barCodeMessage,
                                 final float x,
                                 final float y) throws IOException {
    final float scale = 100f / BAR_CODE_DPI;
    final Code128Bean code128Bean = new Code128Bean();
    code128Bean.setCodeset(Code128Constants.CODESET_C);
    code128Bean.setMsgPosition(HumanReadablePlacement.HRP_NONE);
    code128Bean.setBarHeight(scale * BAR_CODE_HEIGHT_MM);

    final BitmapCanvasProvider canvas = new BitmapCanvasProvider(
            BAR_CODE_DPI, BufferedImage.TYPE_BYTE_BINARY, false, 0);
    code128Bean.generateBarcode(canvas, barCodeMessage);
    canvas.finish();

    final PDImageXObject pdImage = LosslessFactory.createFromImage(pdfDocument, canvas.getBufferedImage());

    try (final PDPageContentStream contentStream = new PDPageContentStream(
            pdfDocument, pdfDocument.getPage(0), PDPageContentStream.AppendMode.APPEND, true)) {
        contentStream.drawImage(pdImage, x, y, scale * pdImage.getWidth(), scale * pdImage.getHeight());
    }

    return this;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:24,代码来源:HunterPaymentPdfFeature.java

示例2: getBarcodeEAN13

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
public static Image getBarcodeEAN13(String value) {
    AbstractBarcodeBean barcode = new EAN13Bean();
    value = BarcodeString.getBarcodeStringEAN13(value);
    barcode.setMsgPosition(HumanReadablePlacement.HRP_BOTTOM);
    barcode.setModuleWidth(1.0);
    barcode.setBarHeight(40.0);
    barcode.setFontSize(10.0);
    barcode.setQuietZone(10.0);
    barcode.doQuietZone(true);
    return getBarcode(value, barcode);
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:12,代码来源:BarcodeImage.java

示例3: getBarcode128

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
public static Image getBarcode128(String value) {
    AbstractBarcodeBean barcode = new Code128Bean();
    value = BarcodeString.getBarcodeStringCode128(value);
    barcode.setMsgPosition(HumanReadablePlacement.HRP_NONE);
    barcode.setModuleWidth(1.0);
    barcode.setBarHeight(40.0);
    barcode.setFontSize(10.0);
    barcode.setQuietZone(10.0);
    barcode.doQuietZone(true);
    return getBarcode(value, barcode);
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:12,代码来源:BarcodeImage.java

示例4: startBarcode

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
/** {@inheritDoc} */
public void startBarcode(String msg, String formattedMsg) {
    super.startBarcode(msg, formattedMsg);
    ITF14Bean bean = getITF14Bean();
    double bbw = bean.getBearerBarWidth();
    double w = dimensions.getWidthPlusQuiet();
    double h = bean.getBarHeight();
    double top = 0;
    if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
        top += bcBean.getHumanReadableHeight();
    }
    canvas.drawRect(0, top, w, top + bbw);
    canvas.drawRect(0, top + bbw + h, w, top + bbw + h + bbw);
    if (bean.isBearerBox()) {
        canvas.drawRect(0, top + bbw, bbw, top + bbw + h);
        canvas.drawRect(w - bbw, top + bbw, w, top + bbw + h);
    }
    //canvas.drawRect(getStartX(), 2 * bbw, getStartX() + dimensions.getWidth(), 3 * bbw);
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:20,代码来源:ITF14CanvasLogicHandler.java

示例5: drawLeadChar

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
private void drawLeadChar(String lead) {
    final double leadw = 7 * bcBean.getBarWidth(1);
    final double leadx = getStartX() 
                - 3 * bcBean.getBarWidth(1)
                - leadw;
                
    if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
        //nop
    } else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
        DrawingUtil.drawText(canvas, bcBean, 
                lead, leadx, leadx + leadw, 
                bcBean.getHumanReadableHeight(), TextAlignment.TA_CENTER);
    } else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
        DrawingUtil.drawText(canvas, bcBean, 
                lead, leadx, leadx + leadw, 
                bcBean.getHeight(), TextAlignment.TA_CENTER);
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:19,代码来源:UPCEANCanvasLogicHandler.java

示例6: drawTrailingChar

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
private void drawTrailingChar(String trailer) {
    final double trailerw = 7 * bcBean.getBarWidth(1);
    final double trailerx = getStartX()
                + this.dim.getWidth()
                - bcBean.supplementalWidth(this.msg)
                + 3 * bcBean.getBarWidth(1);
                
    if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_NONE) {
        //nop
    } else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
        DrawingUtil.drawText(canvas, bcBean, 
                trailer, trailerx, trailerx + trailerw, 
                bcBean.getHumanReadableHeight(), TextAlignment.TA_CENTER);
    } else if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_BOTTOM) {
        DrawingUtil.drawText(canvas, bcBean, 
                trailer, trailerx, trailerx + trailerw, 
                bcBean.getHeight(), TextAlignment.TA_CENTER);
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:20,代码来源:UPCEANCanvasLogicHandler.java

示例7: addBar

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
/**
 * @see org.krysalis.barcode4j.ClassicBarcodeLogicHandler#addBar(boolean, int)
 */
public void addBar(boolean black, int height) {
    POSTNETBean pnBean = (POSTNETBean)bcBean;
    final double w = black ? bcBean.getBarWidth(1) : bcBean.getBarWidth(-1);
    final double h = bcBean.getBarHeight(height);
    final BaselineAlignment baselinePosition = pnBean.getBaselinePosition();
    
    if (black) {
        if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
            if (baselinePosition == BaselineAlignment.ALIGN_TOP) {
                canvas.drawRectWH(x, y + bcBean.getHumanReadableHeight(), w, h);
            } else if (baselinePosition == BaselineAlignment.ALIGN_BOTTOM) {
                canvas.drawRectWH(x, y + bcBean.getHeight() - h, w, h);
            }
        } else {
            if (baselinePosition == BaselineAlignment.ALIGN_TOP) {
                canvas.drawRectWH(x, y, w, h);
            } else if (baselinePosition == BaselineAlignment.ALIGN_BOTTOM) {
                canvas.drawRectWH(x, y + bcBean.getBarHeight() - h, w, h);
            } 
        }
    }
    x += w;
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:27,代码来源:POSTNETLogicHandler.java

示例8: barcodeTextPosition

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
public static HumanReadablePlacement barcodeTextPosition(BarcodeTextPosition textPosition) {
	if (textPosition == null) {
		return null;
	}

	switch (textPosition) {
	case NONE:
		return HumanReadablePlacement.HRP_NONE;
	case BOTTOM:
		return HumanReadablePlacement.HRP_BOTTOM;
	case TOP:
		return HumanReadablePlacement.HRP_TOP;
	default:
		throw new JasperDesignException("BarcodeTextPosition " + textPosition.name() + " not supported");
	}
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:17,代码来源:ConstantTransform.java

示例9: getBarcodeCodabar

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
/**
 *
 * @param value
 * @return
 */
    
public static Image getBarcodeCodabar(String value) {
    AbstractBarcodeBean barcode = new CodabarBean();
    barcode.setMsgPosition(HumanReadablePlacement.HRP_BOTTOM);
    return getBarcode(value, barcode);
}
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:12,代码来源:BarcodeImage.java

示例10: getBarcodeCode39

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
public static Image getBarcodeCode39(String value) {
    AbstractBarcodeBean barcode = new Code39Bean();
    value = BarcodeString.getBarcodeStringCode39(value);
    barcode.setMsgPosition(HumanReadablePlacement.HRP_BOTTOM);
    barcode.setModuleWidth(1.0);
    barcode.setBarHeight(40.0);
    barcode.setFontSize(10.0);
    barcode.setQuietZone(10.0);
    barcode.doQuietZone(true);
    return getBarcode(value, barcode);
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:12,代码来源:BarcodeImage.java

示例11: getBarcodeEAN8

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
public static Image getBarcodeEAN8(String value) {
    AbstractBarcodeBean barcode = new EAN8Bean();
    value = BarcodeString.getBarcodeStringEAN8(value);
    barcode.setMsgPosition(HumanReadablePlacement.HRP_BOTTOM);
    barcode.setModuleWidth(1.0);
    barcode.setBarHeight(40.0);
    barcode.setFontSize(10.0);
    barcode.setQuietZone(10.0);
    barcode.doQuietZone(true);
    return getBarcode(value, barcode);
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:12,代码来源:BarcodeImage.java

示例12: RoyalMailCBCBean

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
/** Create a new instance. */
public RoyalMailCBCBean() {
    super();
    this.msgPos = HumanReadablePlacement.HRP_NONE; //Different default than normal
    setModuleWidth(DEFAULT_MODULE_WIDTH);
    setTrackHeight(1.25f); //mm
    setAscenderHeight(1.8f); //mm
    setQuietZone(2.0); //mm
    setIntercharGapWidth(getModuleWidth());
    updateHeight();
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:12,代码来源:RoyalMailCBCBean.java

示例13: USPSIntelligentMailBean

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
/** Create a new instance. */
public USPSIntelligentMailBean() {
    super();
    setMsgPosition(HumanReadablePlacement.HRP_NONE); //Different default than normal
    setModuleWidth(UnitConv.in2mm(DEFAULT_MODULE_WIDTH_INCH)); //0.015 - 0.025in
    setIntercharGapWidth(UnitConv.in2mm(DEFAULT_INTERCHAR_GAP_WIDTH_INCH)); //0.012 - 0.040in
    //Defaults result in a pitch of 0.045in (22.2 bars per inch)
    
    setQuietZone(UnitConv.in2mm(DEFAULT_HORZ_QUIET_ZONE_INCH));
    setVerticalQuietZone(UnitConv.in2mm(DEFAULT_VERT_QUIET_ZONE_INCH));
    
    setTrackHeight(UnitConv.in2mm(DEFAULT_TRACK_HEIGHT_INCH)); //0.039 - 0.057in
    setAscenderHeight(UnitConv.in2mm(DEFAULT_ASCENDER_HEIGHT_INCH)); //0.0435 - 0.0555in
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:15,代码来源:USPSIntelligentMailBean.java

示例14: getStartY

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
private double getStartY() {
    double y = 0.0;
    if (bcBean.hasQuietZone()) {
        y += bcBean.getVerticalQuietZone();
    }
    if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
        y += bcBean.getHumanReadableHeight();
    }
    return y;
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:11,代码来源:FourStateLogicHandler.java

示例15: getStartY

import org.krysalis.barcode4j.HumanReadablePlacement; //导入依赖的package包/类
/**
 * Returns the start Y position of the bars.
 * @return the start Y position of the bars.
 */
protected double getStartY() {
    double y = 0.0;
    if (bcBean.hasQuietZone()) {
        y += bcBean.getVerticalQuietZone();
    }
    if (bcBean.getMsgPosition() == HumanReadablePlacement.HRP_TOP) {
        y += bcBean.getHumanReadableHeight();
    }
    return y;
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:15,代码来源:DefaultCanvasLogicHandler.java


注:本文中的org.krysalis.barcode4j.HumanReadablePlacement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。