com.java4less.rbarcode
Class BarCode2D

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by com.java4less.rbarcode.BarCode
              extended by com.java4less.rbarcode.BarCode2D
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
BarCodePDF417Bean

public class BarCode2D
extends BarCode

 This class is able to create PDF 417 symbol and Macro PDF 417 Symbols.
 
 Example 1:
 
  BarCode2D bc = new BarCode2D();
  bc.setSize(500,500); // set size of the canvas
  bc.resolution = 1;
  bc.PDFECLevel = 2;
  bc.PDFMode = bc.PDF_BINARY;
  bc.barType = bc.PDF417;
  
  bc.code="this is my data";
  bc.PDFMaxRows = 30;
  bc.PDFColumns = 20 ;
  bc.PDFRows = 5 ;
  myPanel.add(bc);
 
 
 Example 2, how to use MacroPDF417. This example lets RBarcode calculate the number of segments required to encode data.

  BarCode2D bc = new BarCode2D();
  bc.setSize(500,500); // set size of the canvas
  bc.resolution = 1;
  bc.PDFECLevel = 2;
  bc.PDFMode = bc.PDF_BINARY;
  bc.barType = bc.PDF417;
  
  // we will encode 2000 chars
  String input="";
  for (int i=0;i<2000;i++) input=input+"A";
  int[] t = {(byte) 1, (byte) 2, (byte)3};
  bc.code=input;
  bc.PDFMacroFileId = t; // mandatory macro pdf field (FILE ID)
  bc.PDFMacroSender = "sender";  // optional macro pdf field
  bc.PDFMacroAddresse = "addresse"; // optional macro pdf field
  bc.PDFMacroFileSize=input.length(); // optional macro pdf field
  bc.PDFMaxRows = 30;
  bc.PDFColumns = 20 ;
  bc.PDFRows = 5 ;
  
  bc.resetMacroPDF();
  bc.prepareMacroPDF(); // calculate number of segments we need , this will calculate the value for bc.PDFMacroSegmentCount
  
  // paint segments one by one
  for (int i=0; i < bc.PDFMacroSegmentCount; i++)
  {
    bc.PDFMacroSegment = (1 == bc.PDFMacroSegmentCount)? -1 : i; // set current segment index
    int width = barImage.getWidth(null);
    int height = barImage.getHeight(null);
    bc.setSize(width,height);
    BarCodeEncoder encoder=new BarCodeEncoder(bc,"JPG","segment"+i+".jpg");
  }
  
  
 Example 3, how to use MacroPDF417. In this example the user decides what data is encoded in each segment:
 
  BarCode2D bc = new BarCode2D();
   bc.setSize(500,500); // set size of the canvas
  bc.resolution = 1;
  bc.PDFECLevel = 2;
  bc.PDFMode = bc.PDF_BINARY;
  bc.barType = bc.PDF417;
  
  // we will encode 2000 chars
  bc.PDFMacroFileId = t; // mandatory macro pdf field (FILE ID)
  bc.PDFMacroSender = "sender";  // optional macro pdf field
  bc.PDFMacroAddresse = "addresse"; // optional macro pdf field
  bc.PDFMacroFileSize=input.length(); // optional macro pdf field
  bc.PDFMaxRows = 30;
  bc.PDFColumns = 20 ;
  bc.PDFRows = 5 ;
  
  // we will create a 2 segments sequence
  bc.code="this is the data in the first segment";
  bc.PDFMacroSegment=0;
  bc.PDFMacroSegmentCount=2;
  bc.PDFMacroLastSegment=false;
  BarCodeEncoder encoder=new BarCodeEncoder(bc,"JPG","segment1.jpg");
 
   // second segment
  bc.code="this is the data in the second segment";
  bc.PDFMacroSegment=1;
  bc.PDFMacroSegmentCount=2;
  bc.PDFMacroLastSegment=true; // this is the last segment
  BarCodeEncoder encoder=new BarCodeEncoder(bc,"JPG","segment2.jpg");
 

See Also:
Serialized Form

Field Summary
 byte[] codeBinary
          binary data to be encoded
static int PDF_BINARY
          Binary compaction mode
static int PDF_NUMERIC
          Numeric compaction mode
static int PDF_TEXT
          Text compaction mode
 int PDFColumns
          number of columns of the PDF417 code.
 boolean PDFCompact
          compact or truncated mode
 int PDFECLevel
          PDF417 error correction level.
 java.lang.String PDFMacroAddresse
          PDF Macro Adresse
 int[] PDFMacroFileId
          PDF Macro field id
 java.lang.String PDFMacroFileName
          PDF Macro field name
 long PDFMacroFileSize
          PDF Macro file size
 boolean PDFMacroLastSegment
          set it to true if you are creating the last segment of the sequence in a macro pdf 417 barcode
 int PDFMacroSegment
          PDF Macro segment
 int PDFMacroSegmentCount
          number of Macro PDF symbols needed
 java.lang.String PDFMacroSender
          PDF Macro Sender
 java.lang.String PDFMacroTimeStamp
          PDF Macro time stamp
 int PDFMaxRows
          maximum number of rows.
 int PDFMode
          PDF417 mode.
 int[] PDFPointerNextData
          number of rows of the PDF417 code.
 int PDFRows
          preferred number of rows.
 
Fields inherited from class com.java4less.rbarcode.BarCode
backColor, BAR39, BAR39EXT, barColor, barHeightCM, barType, checkCharacter, CODABAR, CODABARStartChar, CODABARStopChar, code, CODE11, CODE128, Code128Set, CODE93, CODE93EXT, codeText, DATAMATRIX, EAN128, EAN13, EAN8, fontColor, guardBars, H, I, IND25, INTERLEAVED25, L, leftMarginCM, MAT25, MSI, MSI_CHECKSUM_10, MSI_CHECKSUM_10_10, MSI_CHECKSUM_11, MSI_CHECKSUM_11_10, MSIChecksum, N, PDF417, POSTNET, postnetHeightShortBar, postnetHeightTallBar, processTilde, resolution, rotate, supHeight, supplement, supSeparationCM, textFont, textOnTop, topMarginCM, UPCA, UPCE, UPCEANSupplement2, UPCEANSupplement5, UPCESytem, X
 
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
BarCode2D()
           
 
Method Summary
 void prepareMacroPDF()
          Only Macro PDF.
 void resetMacroPDF()
          call this before creating a new Macro PDF barcode
 
Methods inherited from class com.java4less.rbarcode.BarCode
getAiLen, getEAN128Text, getFixedFieldLen, getPaintedArea, paint, print
 
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, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, 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, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PDFPointerNextData

public int[] PDFPointerNextData
number of rows of the PDF417 code. If 0 the number will be calculated automatically.


PDFRows

public int PDFRows
preferred number of rows. The default value is 3.


PDFMaxRows

public int PDFMaxRows
maximum number of rows. The default value is 30.


PDFColumns

public int PDFColumns
number of columns of the PDF417 code. The default value is 10


PDFECLevel

public int PDFECLevel
PDF417 error correction level. The default value is 0.


PDFMode

public int PDFMode
PDF417 mode. Valid values are PDF_BINARY (default), PDF_TEXT (for ascii data) and PDF_NUMERIC (for numeric data).


PDF_BINARY

public static final int PDF_BINARY
Binary compaction mode

See Also:
Constant Field Values

PDF_TEXT

public static final int PDF_TEXT
Text compaction mode

See Also:
Constant Field Values

PDF_NUMERIC

public static final int PDF_NUMERIC
Numeric compaction mode

See Also:
Constant Field Values

PDFCompact

public boolean PDFCompact
compact or truncated mode


PDFMacroSegment

public int PDFMacroSegment
PDF Macro segment


PDFMacroFileId

public int[] PDFMacroFileId
PDF Macro field id


PDFMacroFileName

public java.lang.String PDFMacroFileName
PDF Macro field name


PDFMacroTimeStamp

public java.lang.String PDFMacroTimeStamp
PDF Macro time stamp


PDFMacroSender

public java.lang.String PDFMacroSender
PDF Macro Sender


PDFMacroAddresse

public java.lang.String PDFMacroAddresse
PDF Macro Adresse


PDFMacroFileSize

public long PDFMacroFileSize
PDF Macro file size


PDFMacroSegmentCount

public int PDFMacroSegmentCount
number of Macro PDF symbols needed


PDFMacroLastSegment

public boolean PDFMacroLastSegment
set it to true if you are creating the last segment of the sequence in a macro pdf 417 barcode


codeBinary

public byte[] codeBinary
binary data to be encoded

Constructor Detail

BarCode2D

public BarCode2D()
Method Detail

resetMacroPDF

public void resetMacroPDF()
call this before creating a new Macro PDF barcode


prepareMacroPDF

public void prepareMacroPDF()
Only Macro PDF. Call this to calculate the number of symbols needed