Package com.idautomation.pdf417
Class PDF417
java.lang.Object
java.awt.Component
java.awt.Canvas
com.idautomation.pdf417.PDF417
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
This is the main PDF417 class that generates the PDF417 barcode image
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
If true, will automatically size the control canvas to fit the barcode at design or runtime; Default =True.Background color.Color of the bars.byte[]
The data (as a byte array) to be encoded in the barcode.The data (as a string) to be encoded in the barcode.int
double
int
double
double
double
Left margin of the Barcode (also know as quiet zone).boolean
Determines whether or not this barcode is a MacroPDF barcode.int
The MacroPDF File ID corresponding to this barcode.boolean
Determines whether this MacroPDF barcode is the last in the series.int
The MacroPDF Segment Index corresponding to this barcode.double
static final int
static final int
static final int
int
The number of columns in the PDF417 code; the default is 5; the range is from 1 to 30.int
PDF417 error correction level; the default is 2; the range is from 0 to 8.int
PDF417 mode; Valid values are 0 for BINARY (default), 1 for TEXT (for ascii data) and 2 for NUMERIC (for numeric only data).int
The number of rows of the PDF417 code; If 0 (default) the number will be calculated automatically.int
The preferred height of the barcode image in pixels after barcode is generated.boolean
If true, three numbers after the Tilde will insert an ASCII code; For example ~009 will insert ASCII 9 into the data string.int
The preferred width of the barcode image in pixels after barcode is generated.int
The resolution used to create the X dimension and other measurements in pixels; Default is 38 Pixels Per CM which is about 96 DPI.int
Rotation angle; valid values are 0 (default), 90, 180 & 270.static final long
double
Top margin of the Barcode (also know as quiet zone).boolean
If true, truncated PDF417 code will be created; Default =False.int
double
Size in CM of narrow modules; if X * resolution = < 1, X will be set to one pixel; resolution is used to convert to pixels; use setPixelsPerCM to change the resolution.double
The X multiple height of individual cells; default=3, usually 2 to 4 times X (make as small as possible, some scanners cannot read less than 3 or 4).Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
convertToBufferedImage
(Image image) boolean
Gets the autoSize property.Gets the backColor property.Gets the code property.Gets the barColor property.double
Gets the leftMarginCM property.boolean
Gets the MacroPDFEnable property.int
Gets the MacroPDFFileID property.boolean
Gets the MacroPDFLastSegment property.int
Gets the MacroPDFSegmentIndex property.Gets the minimum size in pixels of the barcode image generated.int
Gets the PDFColumns property.int
Gets the PDFECLevel property.int
Gets the PDFMode property.int
Gets the PDFRows property.int
Gets the resolution property.Gets the size in pixels of the Preferred barcode image generated.boolean
Gets the processTilde property.int
Gets the rotate property.double
Gets the topMarginCM property.boolean
Gets the truncated property.double
Gets the X property.double
Gets the XtoYRatio property.void
Paints the barcode and rotates it if necessaryvoid
setAutoSize
(boolean newVal) Sets the autoSize property.void
setBackground
(Color newColor) Sets the backColor property.void
setDataToEncode
(String newCode) Sets the code property.void
setForeground
(Color newColor) Sets the barColor property.void
setImageSize
(int imgWidth, int imgHeight) Sets the size of the generated image, if used then autoSize is set to false.void
setLeftMarginCM
(double newMargin) Sets the leftMarginCM property.void
setMacroPDFEnable
(boolean Macro) Sets the MacroPDFEnable property.void
setMacroPDFFileID
(int fileid) Sets the MacroPDFFileID property.void
setMacroPDFLastSegment
(boolean Macro) Sets the MacroPDFLastSegment property.void
setMacroPDFSegmentIndex
(int index) Sets the MacroPDFSegmentIndex property.void
setPDFColumns
(int newColumns) Sets the PDFColumns property.void
setPDFErrorCorrection
(int newEC) Sets the PDFECLevel property.void
setPDFMode
(int newMode) Sets the PDFMode property.void
setPDFRows
(int newRows) Sets the PDFRows property.void
setPixelsPerCM
(int newRes) Sets the resolution property.void
setProcessTilde
(boolean pt) Sets the processTilde property.void
setRotationAngle
(int newRotate) Sets the rotate property.void
setTopMarginCM
(double newMargin) Sets the topMarginCM property.void
setTruncated
(boolean newVal) Sets the truncated property.void
setXDimensionCM
(double newX) Sets the X property.void
setXtoYRatio
(double newRatio) Sets the XtoYRatio property.Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
dotPixels
public int dotPixels -
binaryCode
public byte[] binaryCodeThe data (as a byte array) to be encoded in the barcode. -
code
The data (as a string) to be encoded in the barcode. -
processTilde
public boolean processTildeIf true, three numbers after the Tilde will insert an ASCII code; For example ~009 will insert ASCII 9 into the data string. -
leftMarginCM
public double leftMarginCMLeft margin of the Barcode (also know as quiet zone). The default is .2 CM. -
topMarginCM
public double topMarginCMTop margin of the Barcode (also know as quiet zone). The default is .2 CM -
backColor
Background color. -
MacroPDFEnable
public boolean MacroPDFEnableDetermines whether or not this barcode is a MacroPDF barcode. -
MacroPDFSegmentIndex
public int MacroPDFSegmentIndexThe MacroPDF Segment Index corresponding to this barcode. Valid values are 0 to 99998 -
MacroPDFFileID
public int MacroPDFFileIDThe MacroPDF File ID corresponding to this barcode. Valid values are 0 to 899 -
MacroPDFLastSegment
public boolean MacroPDFLastSegmentDetermines whether this MacroPDF barcode is the last in the series. -
resolution
public int resolutionThe resolution used to create the X dimension and other measurements in pixels; Default is 38 Pixels Per CM which is about 96 DPI. 96 DPI is the resolution of the web browser; this setting works best when using the servlet. Enter 118 to create a 300 DPI image. -
N
public double N -
X
public double XSize in CM of narrow modules; if X * resolution = < 1, X will be set to one pixel; resolution is used to convert to pixels; use setPixelsPerCM to change the resolution. -
XtoYRatio
public double XtoYRatioThe X multiple height of individual cells; default=3, usually 2 to 4 times X (make as small as possible, some scanners cannot read less than 3 or 4). -
truncated
public boolean truncatedIf true, truncated PDF417 code will be created; Default =False. -
width
public int width -
height
public int height -
pWidth
public int pWidthThe preferred width of the barcode image in pixels after barcode is generated.- See Also:
-
pHeight
public int pHeightThe preferred height of the barcode image in pixels after barcode is generated.- See Also:
-
autoSize
public boolean autoSizeIf true, will automatically size the control canvas to fit the barcode at design or runtime; Default =True. -
barColor
Color of the bars. -
I
public double I -
H
public double H -
L
public double L -
rotate
public int rotateRotation angle; valid values are 0 (default), 90, 180 & 270. -
PDFRows
public int PDFRowsThe number of rows of the PDF417 code; If 0 (default) the number will be calculated automatically. We recommend changing the columns instead of the rows to size the symbol.- See Also:
-
PDFColumns
public int PDFColumnsThe number of columns in the PDF417 code; the default is 5; the range is from 1 to 30. -
PDFECLevel
public int PDFECLevelPDF417 error correction level; the default is 2; the range is from 0 to 8. -
PDF_BINARY
public static final int PDF_BINARY- See Also:
-
PDF_TEXT
public static final int PDF_TEXT- See Also:
-
PDF_NUMERIC
public static final int PDF_NUMERIC- See Also:
-
PDFMode
public int PDFModePDF417 mode; Valid values are 0 for BINARY (default), 1 for TEXT (for ascii data) and 2 for NUMERIC (for numeric only data).- See Also:
-
-
Constructor Details
-
PDF417
public PDF417()
-
-
Method Details
-
setDataToEncode
Sets the code property.- Parameters:
newCode
- the new value for the code variable.- See Also:
-
getDataToEncode
Gets the code property.- Returns:
- the current value of the code variable.
- See Also:
-
setProcessTilde
public void setProcessTilde(boolean pt) Sets the processTilde property.- Parameters:
pt
- the new value for the processTilde variable.- See Also:
-
getProcessTilde
public boolean getProcessTilde()Gets the processTilde property.- Returns:
- the current string value of th processTildee variable.
- See Also:
-
setLeftMarginCM
public void setLeftMarginCM(double newMargin) Sets the leftMarginCM property.- Parameters:
newMargin
- the new value for the leftMarginCM variable.- See Also:
-
getLeftMarginCM
public double getLeftMarginCM()Gets the leftMarginCM property.- Returns:
- the current value of the leftMarginCM variable.
- See Also:
-
setTopMarginCM
public void setTopMarginCM(double newMargin) Sets the topMarginCM property.- Parameters:
newMargin
- the new value for the topMarginCM variable.- See Also:
-
getTopMarginCM
public double getTopMarginCM()Gets the topMarginCM property.- Returns:
- the current value of the topMarginCM variable.
- See Also:
-
setBackground
Sets the backColor property.- Overrides:
setBackground
in classComponent
- Parameters:
newColor
- the new value for the backColor variable.- See Also:
-
getBackground
Gets the backColor property.- Overrides:
getBackground
in classComponent
- Returns:
- the current value of the backColor variable.
- See Also:
-
setMacroPDFEnable
public void setMacroPDFEnable(boolean Macro) Sets the MacroPDFEnable property.- Parameters:
Macro
- the new value for the MacroPDFEnable variable.- See Also:
-
getMacroPDFEnable
public boolean getMacroPDFEnable()Gets the MacroPDFEnable property.- Returns:
- the current value of the MacroPDFEnable variable.
- See Also:
-
setMacroPDFSegmentIndex
public void setMacroPDFSegmentIndex(int index) Sets the MacroPDFSegmentIndex property.- Parameters:
index
- the new value for the MacroPDFSegmentIndex variable.- See Also:
-
getMacroPDFSegmentIndex
public int getMacroPDFSegmentIndex()Gets the MacroPDFSegmentIndex property.- Returns:
- the current value of the MacroPDFSegmentIndex variable.
- See Also:
-
setMacroPDFFileID
public void setMacroPDFFileID(int fileid) Sets the MacroPDFFileID property.- Parameters:
fileid
- the new value for the MacroPDFFileID variable.- See Also:
-
getMacroPDFFileID
public int getMacroPDFFileID()Gets the MacroPDFFileID property.- Returns:
- the current value of the MacroPDFFileID variable.
- See Also:
-
setMacroPDFLastSegment
public void setMacroPDFLastSegment(boolean Macro) Sets the MacroPDFLastSegment property.- Parameters:
Macro
- the new value for the MacroPDFLastSegment variable.- See Also:
-
getMacroPDFLastSegment
public boolean getMacroPDFLastSegment()Gets the MacroPDFLastSegment property.- Returns:
- the current value of the MacroPDFLastSegment variable.
- See Also:
-
setPixelsPerCM
public void setPixelsPerCM(int newRes) Sets the resolution property.- Parameters:
newRes
- the new value for the resolution variable.- See Also:
-
getPixelsPerCM
public int getPixelsPerCM()Gets the resolution property.- Returns:
- the current value of the resolution variable.
- See Also:
-
setXDimensionCM
public void setXDimensionCM(double newX) Sets the X property.- Parameters:
newX
- the new value for the X variable.- See Also:
-
getXDimensionCM
public double getXDimensionCM()Gets the X property.- Returns:
- the current value of the X variable.
- See Also:
-
setXtoYRatio
public void setXtoYRatio(double newRatio) Sets the XtoYRatio property.- Parameters:
newRatio
- the new value for the XtoYRatio variable.- See Also:
-
getXtoYRatio
public double getXtoYRatio()Gets the XtoYRatio property.- Returns:
- the current value of the XtoYRatio variable.
- See Also:
-
setTruncated
public void setTruncated(boolean newVal) Sets the truncated property.- Parameters:
newVal
- the new value for the truncated variable.- See Also:
-
getTruncated
public boolean getTruncated()Gets the truncated property.- Returns:
- the current value of the truncated variable.
- See Also:
-
setImageSize
public void setImageSize(int imgWidth, int imgHeight) Sets the size of the generated image, if used then autoSize is set to false.- See Also:
-
setAutoSize
public void setAutoSize(boolean newVal) Sets the autoSize property.- Parameters:
newVal
- the new value for the autoSize variable.- See Also:
-
getAutoSize
public boolean getAutoSize()Gets the autoSize property.- Returns:
- the current value of the autoSize variable.
- See Also:
-
getPreferredSize
Gets the size in pixels of the Preferred barcode image generated.- Overrides:
getPreferredSize
in classComponent
- Returns:
- Dimension(pWidth,pHeight)
- See Also:
-
getMinimumSize
Gets the minimum size in pixels of the barcode image generated.- Overrides:
getMinimumSize
in classComponent
- Returns:
- Dimension(10,10)
- See Also:
-
setForeground
Sets the barColor property.- Overrides:
setForeground
in classComponent
- Parameters:
newColor
- the new value for the barColor variable.- See Also:
-
getForeground
Gets the barColor property.- Overrides:
getForeground
in classComponent
- Returns:
- the current value of the barColor variable.
- See Also:
-
setRotationAngle
public void setRotationAngle(int newRotate) Sets the rotate property.- Parameters:
newRotate
- the new value for the rotate variable.- See Also:
-
getRotationAngle
public int getRotationAngle()Gets the rotate property.- Returns:
- the current value of the rotate variable.
- See Also:
-
setPDFRows
public void setPDFRows(int newRows) Sets the PDFRows property.- Parameters:
newRows
- the new value for the PDFRows variable.- See Also:
-
getPDFRows
public int getPDFRows()Gets the PDFRows property.- Returns:
- the current value of the PDFRows variable.
- See Also:
-
setPDFColumns
public void setPDFColumns(int newColumns) Sets the PDFColumns property.- Parameters:
newColumns
- the new value for the PDFColumns variable.- See Also:
-
getPDFColumns
public int getPDFColumns()Gets the PDFColumns property.- Returns:
- the current value of the PDFColumns variable.
- See Also:
-
setPDFErrorCorrection
public void setPDFErrorCorrection(int newEC) Sets the PDFECLevel property.- Parameters:
newEC
- the new value for the PDFECLevel variable.- See Also:
-
getPDFErrorCorrection
public int getPDFErrorCorrection()Gets the PDFECLevel property.- Returns:
- the current value of the PDFECLevel variable.
- See Also:
-
setPDFMode
public void setPDFMode(int newMode) Sets the PDFMode property.- Parameters:
newMode
- the new value for the PDFMode variable.- See Also:
-
getPDFMode
public int getPDFMode()Gets the PDFMode property.- Returns:
- the current value of the PDFMode variable.
- See Also:
-
paint
Paints the barcode and rotates it if necessary -
convertToBufferedImage
-