public class Barcode extends AbstractComponent
Copyright (c) 2020 xsx All Rights Reserved. x-easypdf-pdfbox is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.
Modifier and Type | Field and Description |
---|---|
protected Float |
alpha
透明度
|
protected Float |
angle
旋转角度
|
protected static Map<Integer,BufferedImage> |
CACHE
缓存
|
protected BarcodeType |
codeType
编码类型
|
protected String |
content
内容
|
protected Map<com.google.zxing.EncodeHintType,Object> |
encodeHints
编码设置
|
protected Integer |
height
高度(显示)
|
protected Integer |
imageHeight
图像高度
|
protected Integer |
imageWidth
图像宽度
|
protected Boolean |
isCache
是否缓存
|
protected Boolean |
isNoWhiteBorder
是否无白边
|
protected Boolean |
isShowWords
是否显示文字
|
protected static ReentrantLock |
LOCK
缓存锁
|
protected Color |
offColor
背景颜色
|
protected Color |
onColor
前景颜色
|
protected Integer |
width
宽度(显示)
|
protected String |
words
文字
|
protected Color |
wordsColor
文字颜色
|
protected String |
wordsFontName
文字字体名称
|
protected Integer |
wordsOffsetX
文字X轴偏移量
|
protected Integer |
wordsOffsetY
文字Y轴偏移量
|
protected Integer |
wordsSize
文字大小
|
protected BarcodeWordsStyle |
wordsStyle
文字样式
|
beginX, beginY, borderConfiguration, horizontalAlignment, isBreak, isCustomPosition, isWrap, marginConfiguration, pagingCondition, pagingEvents, relativeBeginX, relativeBeginY, verticalAlignment
contentMode, context, isResetContentStream, log
Modifier and Type | Method and Description |
---|---|
protected BufferedImage |
addImageWords(BufferedImage image)
添加图像文字
|
protected int |
cacheKey()
缓存key
|
protected BufferedImage |
createBarcodeImage()
创建条形码图像
|
protected BufferedImage |
getBarcodeImage()
获取条形码图像
|
protected org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject |
getImageXObject()
获取图像对象
|
protected float |
getMinWidth()
获取最小宽度
|
ComponentType |
getType()
获取类型
|
protected void |
init()
初始化
|
protected void |
initErrorLevel()
初始化纠错级别
|
protected void |
initWidthAndHeight()
初始化宽度与高度
|
protected com.google.zxing.common.BitMatrix |
removeWhiteBorder(com.google.zxing.common.BitMatrix matrix)
移除白边
|
protected void |
reset()
重置
|
void |
setCodeMargin(int margin)
设置条形码边距
|
void |
setEncodeHints(com.google.zxing.EncodeHintType type,
Object value)
设置编码提示
|
void |
setErrorLevel(BarcodeErrorLevel level)
设置纠错级别
|
void |
setHeight(int height)
设置高度(显示)
|
void |
setImageHeight(int height)
设置图像高度(生成)
|
void |
setImageWidth(int width)
设置图像宽度(生成)
|
void |
setQrCompact(boolean isCompact)
设置二维码紧凑模式(仅二维码有效)
|
void |
setQrMaskPattern(int pattern)
设置二维码掩码模式(仅二维码有效)
|
void |
setQrVersion(int version)
设置二维码版本(仅二维码有效)
|
void |
setWidth(int width)
设置宽度(显示)
|
protected BufferedImage |
toBufferedImage(com.google.zxing.common.BitMatrix matrix)
转图像
|
protected void |
writeContents()
写入内容
|
addPagingEvent, checkPaging, checkPaging, checkPaging, checkWrap, close, executeBreak, getBase, getBorderBottomColor, getBorderDottedSpacing, getBorderLeftColor, getBorderLineCapStyle, getBorderLineLength, getBorderLineStyle, getBorderLineWidth, getBorderRightColor, getBorderTopColor, getBottom, getIsBorderBottom, getIsBorderLeft, getIsBorderRight, getIsBorderTop, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getPage, initBeginX, initBeginXY, initBeginY, initBeginYForPaging, isNeedWrap, isPaging, isPagingComponent, isWrap, processBreak, render, reset, resetXY, setBeginX, setBeginX, setBeginY, setBeginY, setBorderBottomColor, setBorderColor, setBorderDottedSpacing, setBorderLeftColor, setBorderLineCapStyle, setBorderLineLength, setBorderLineStyle, setBorderLineWidth, setBorderRightColor, setBorderRightColor, setBorderTopColor, setIsBorder, setIsBorderBottom, setIsBorderLeft, setIsBorderRight, setIsBorderTop, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, virtualRender, wrap
init, init
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContext, getPagingCondition, getPagingEvents, setHorizontalAlignment, setVerticalAlignment
protected static final Map<Integer,BufferedImage> CACHE
protected static final ReentrantLock LOCK
protected Integer width
protected Integer height
protected Integer imageWidth
protected Integer imageHeight
protected BarcodeType codeType
protected Color onColor
protected Color offColor
protected String content
protected String words
protected String wordsFontName
protected Color wordsColor
protected BarcodeWordsStyle wordsStyle
protected Integer wordsSize
protected Integer wordsOffsetX
protected Integer wordsOffsetY
protected Float angle
protected Float alpha
protected Boolean isShowWords
protected Boolean isNoWhiteBorder
protected Boolean isCache
public Barcode(Page page)
page
- 页面public void setWidth(int width)
width
- 宽度public void setHeight(int height)
height
- 高度public void setImageWidth(int width)
width
- 宽度public void setImageHeight(int height)
height
- 高度public void setCodeMargin(int margin)
margin
- 条形码边距public void setErrorLevel(BarcodeErrorLevel level)
level
- 纠错级别public void setQrVersion(int version)
version
- 版本public void setQrMaskPattern(int pattern)
pattern
- 掩码模式public void setQrCompact(boolean isCompact)
isCompact
- 是否紧凑public void setEncodeHints(com.google.zxing.EncodeHintType type, Object value)
type
- 类型value
- 值public ComponentType getType()
protected float getMinWidth()
getMinWidth
in class AbstractComponent
protected void init()
init
in class AbstractComponent
protected void initWidthAndHeight()
protected void initErrorLevel()
protected void writeContents()
writeContents
in class AbstractComponent
protected void reset()
reset
in class AbstractComponent
protected org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject getImageXObject()
protected BufferedImage getBarcodeImage()
protected BufferedImage createBarcodeImage()
protected BufferedImage toBufferedImage(com.google.zxing.common.BitMatrix matrix)
matrix
- 位矩阵protected com.google.zxing.common.BitMatrix removeWhiteBorder(com.google.zxing.common.BitMatrix matrix)
matrix
- 矩阵protected BufferedImage addImageWords(BufferedImage image)
image
- 图像protected int cacheKey()
Copyright © 2024. All rights reserved.