⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 barcode.java

📁 处理PDF
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * @return the text alignment     */    public int getTextAlignment() {        return textAlignment;    }        /** Sets the text alignment. Can be <CODE>Element.ALIGN_LEFT</CODE>,     * <CODE>Element.ALIGN_CENTER</CODE> or <CODE>Element.ALIGN_RIGHT</CODE>.     * @param textAlignment the text alignment     */    public void setTextAlignment(int textAlignment) {        this.textAlignment = textAlignment;    }        /** Gets the optional checksum generation.     * @return the optional checksum generation     */    public boolean isGenerateChecksum() {        return generateChecksum;    }        /** Setter for property generateChecksum.     * @param generateChecksum New value of property generateChecksum.     */    public void setGenerateChecksum(boolean generateChecksum) {        this.generateChecksum = generateChecksum;    }        /** Gets the property to show the generated checksum in the the text.     * @return value of property checksumText     */    public boolean isChecksumText() {        return checksumText;    }        /** Sets the property to show the generated checksum in the the text.     * @param checksumText new value of property checksumText     */    public void setChecksumText(boolean checksumText) {        this.checksumText = checksumText;    }        /** Sets the property to show the start and stop character '*' in the text for     * the barcode 39.     * @return value of property startStopText     */    public boolean isStartStopText() {        return startStopText;    }        /** Gets the property to show the start and stop character '*' in the text for     * the barcode 39.     * @param startStopText new value of property startStopText     */    public void setStartStopText(boolean startStopText) {        this.startStopText = startStopText;    }        /** Gets the property to generate extended barcode 39.     * @return value of property extended.     */    public boolean isExtended() {        return extended;    }        /** Sets the property to generate extended barcode 39.     * @param extended new value of property extended     */    public void setExtended(boolean extended) {        this.extended = extended;    }        /** Gets the code to generate.     * @return the code to generate     */    public String getCode() {        return code;    }        /** Sets the code to generate.     * @param code the code to generate     */    public void setCode(String code) {        this.code = code;    }        /** Gets the property to show the guard bars for barcode EAN.     * @return value of property guardBars     */    public boolean isGuardBars() {        return guardBars;    }        /** Sets the property to show the guard bars for barcode EAN.     * @param guardBars new value of property guardBars     */    public void setGuardBars(boolean guardBars) {        this.guardBars = guardBars;    }        /** Gets the code type.     * @return the code type     */    public int getCodeType() {        return codeType;    }        /** Sets the code type.     * @param codeType the code type     */    public void setCodeType(int codeType) {        this.codeType = codeType;    }        /** Gets the maximum area that the barcode and the text, if     * any, will occupy. The lower left corner is always (0, 0).     * @return the size the barcode occupies.     */        public abstract Rectangle getBarcodeSize();        /** Places the barcode in a <CODE>PdfContentByte</CODE>. The     * barcode is always placed at coordinates (0, 0). Use the     * translation matrix to move it elsewhere.<p>     * The bars and text are written in the following colors:<p>     * <P><TABLE BORDER=1>     * <TR>     *    <TH><P><CODE>barColor</CODE></TH>     *    <TH><P><CODE>textColor</CODE></TH>     *    <TH><P>Result</TH>     *    </TR>     * <TR>     *    <TD><P><CODE>null</CODE></TD>     *    <TD><P><CODE>null</CODE></TD>     *    <TD><P>bars and text painted with current fill color</TD>     *    </TR>     * <TR>     *    <TD><P><CODE>barColor</CODE></TD>     *    <TD><P><CODE>null</CODE></TD>     *    <TD><P>bars and text painted with <CODE>barColor</CODE></TD>     *    </TR>     * <TR>     *    <TD><P><CODE>null</CODE></TD>     *    <TD><P><CODE>textColor</CODE></TD>     *    <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD>     *    </TR>     * <TR>     *    <TD><P><CODE>barColor</CODE></TD>     *    <TD><P><CODE>textColor</CODE></TD>     *    <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD>     *    </TR>     * </TABLE>     * @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed     * @param barColor the color of the bars. It can be <CODE>null</CODE>     * @param textColor the color of the text. It can be <CODE>null</CODE>     * @return the dimensions the barcode occupies     */        public abstract Rectangle placeBarcode(PdfContentByte cb, Color barColor, Color textColor);        /** Creates a template with the barcode.     * @param cb the <CODE>PdfContentByte</CODE> to create the template. It     * serves no other use     * @param barColor the color of the bars. It can be <CODE>null</CODE>     * @param textColor the color of the text. It can be <CODE>null</CODE>     * @return the template     * @see #placeBarcode(PdfContentByte cb, Color barColor, Color textColor)     */        public PdfTemplate createTemplateWithBarcode(PdfContentByte cb, Color barColor, Color textColor) {        PdfTemplate tp = cb.createTemplate(0, 0);        Rectangle rect = placeBarcode(tp, barColor, textColor);        tp.setBoundingBox(rect);        return tp;    }        /** Creates an <CODE>Image</CODE> with the barcode.     * @param cb the <CODE>PdfContentByte</CODE> to create the <CODE>Image</CODE>. It     * serves no other use     * @param barColor the color of the bars. It can be <CODE>null</CODE>     * @param textColor the color of the text. It can be <CODE>null</CODE>     * @return the <CODE>Image</CODE>     * @see #placeBarcode(PdfContentByte cb, Color barColor, Color textColor)     */        public Image createImageWithBarcode(PdfContentByte cb, Color barColor, Color textColor) {        try {            return Image.getInstance(createTemplateWithBarcode(cb, barColor, textColor));        }        catch (Exception e) {            throw new ExceptionConverter(e);        }    }        /** Creates a <CODE>java.awt.Image</CODE>. This image only     * contains the bars without any text.     * @param foreground the color of the bars     * @param background the color of the background     * @return the image     */        public abstract java.awt.Image createAwtImage(Color foreground, Color background);        /** Gets the amount of ink spreading.     * @return the ink spreading     *     */    public float getInkSpreading() {        return this.inkSpreading;    }        /** Sets the amount of ink spreading. This value will be subtracted     * to the width of each bar. The actual value will depend on the ink     * and the printing medium.     * @param inkSpreading the ink spreading     *     */    public void setInkSpreading(float inkSpreading) {    	this.inkSpreading = inkSpreading;    }    /**     * The alternate text to be used, if present.     */    protected String altText;    /**     * Gets the alternate text.     * @return the alternate text     */    public String getAltText() {        return this.altText;    }    /**     * Sets the alternate text. If present, this text will be used instead of the     * text derived from the supplied code.     * @param altText the alternate text     */    public void setAltText(String altText) {        this.altText = altText;    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -