iText 8.0.5 API
iText.Barcodes.BarcodePDF417 Class Reference

PDF417 is a stacked linear barcode format used in a variety of applications such as transport, identification cards, and inventory management. More...

Inheritance diagram for iText.Barcodes.BarcodePDF417:
iText.Barcodes.Barcode2D

Classes

class   Segment
  A container that encapsulates all data needed for a segment. More...
 
class   SegmentList
  An utility class that encapsulates a list of segments. More...
 

Public Member Functions

  BarcodePDF417 ()
  Creates a new BarcodePDF417 with the default settings. More...
 
virtual void  SetMacroSegmentId (int id)
  Sets the segment id for macro PDF417 encoding More...
 
virtual void  SetMacroSegmentCount (int cnt)
  Sets the segment count for macro PDF417 encoding More...
 
virtual void  SetMacroFileId (String id)
  Sets the File ID for macro PDF417 encoding More...
 
virtual void  SetDefaultParameters ()
  Set the default settings that correspond to PDF417_USE_ASPECT_RATIO and PDF417_AUTO_ERROR_LEVEL. More...
 
override Rectangle  GetBarcodeSize ()
  Gets the maximum area that the barcode and the text, if any, will occupy. More...
 
override Rectangle  PlaceBarcode (PdfCanvas canvas, Color foreground)
  Places the barcode in a PdfCanvas. More...
 
virtual Rectangle  PlaceBarcode (PdfCanvas canvas, Color foreground, float moduleWidth, float moduleHeight)
  Places the barcode in a iText.Kernel.Pdf.Canvas.PdfCanvas. More...
 
virtual void  PaintCode ()
  Paints the barcode. More...
 
override PdfFormXObject  CreateFormXObject (Color foreground, PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 
virtual PdfFormXObject  CreateFormXObject (Color foreground, float moduleWidth, float moduleHeight, PdfDocument document)
  Creates a PdfFormXObject with the barcode with given module width and module height. More...
 
virtual byte[]  GetOutBits ()
  Gets the raw image bits of the barcode. More...
 
virtual int  GetBitColumns ()
  Gets the number of X pixels of outBits. More...
 
virtual int  GetCodeRows ()
  Gets the number of Y pixels of outBits. More...
 
virtual void  SetCodeRows (int codeRows)
  Sets the number of barcode rows. More...
 
virtual int  GetCodeColumns ()
  Gets the number of barcode data columns. More...
 
virtual void  SetCodeColumns (int codeColumns)
  Sets the number of barcode data columns. More...
 
virtual int[]  GetCodewords ()
  Gets the codeword array. More...
 
virtual int  GetLenCodewords ()
  Gets the length of the codewords. More...
 
virtual void  SetLenCodewords (int lenCodewords)
  Sets the length of the codewords. More...
 
virtual int  GetErrorLevel ()
  Gets the error level correction used for the barcode. More...
 
virtual void  SetErrorLevel (int errorLevel)
  Sets the error level correction for the barcode. More...
 
virtual byte[]  GetCode ()
  Gets the bytes that form the barcode. More...
 
virtual void  SetCode (byte[] code)
  Sets the bytes that form the barcode. More...
 
virtual void  SetCode (String text)
  Sets the code that will form the barcode. More...
 
virtual int  GetOptions ()
  Gets the options to generate the barcode. More...
 
virtual void  SetOptions (int options)
  Sets the options to generate the barcode. More...
 
virtual float  GetAspectRatio ()
  Gets the barcode aspect ratio. More...
 
virtual void  SetAspectRatio (float aspectRatio)
  Sets the barcode aspect ratio. More...
 
virtual float  GetYHeight ()
  Gets the Y pixel height relative to X. More...
 
virtual void  SetYHeight (float yHeight)
  Sets the Y pixel height relative to X. More...
 
- Public Member Functions inherited from iText.Barcodes.Barcode2D
virtual PdfFormXObject  CreateFormXObject (PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 

Static Public Attributes

const int  PDF417_USE_ASPECT_RATIO = 0
  Auto-size is made based on aspectRatio and yHeight. More...
 
const int  PDF417_FIXED_RECTANGLE = 1
  The size of the barcode will be at least codeColumns*codeRows. More...
 
const int  PDF417_FIXED_COLUMNS = 2
  The size will be at least codeColumns with a variable number of codeRows. More...
 
const int  PDF417_FIXED_ROWS = 4
  The size will be at least codeRows with a variable number of codeColumns. More...
 
const int  PDF417_AUTO_ERROR_LEVEL = 0
  The error level correction is set automatically according to ISO 15438 recommendations. More...
 
const int  PDF417_USE_ERROR_LEVEL = 16
  The error level correction is set by the user. More...
 
const int  PDF417_FORCE_BINARY = 32
  One single binary segment is used More...
 
const int  PDF417_USE_RAW_CODEWORDS = 64
  No text interpretation is done and the content of codewords is used directly. More...
 
const int  PDF417_INVERT_BITMAP = 128
  Inverts the output bits of the raw bitmap that is normally bit one for black. More...
 
const int  PDF417_USE_MACRO = 256
  Use Macro PDF417 Encoding More...
 

Package Functions

virtual void  OutCodeword17 (int codeword)
  Adds the code word to the correct code word to the 17th bit. More...
 
virtual void  OutCodeword18 (int codeword)
  Adds the code word to the correct code word to the 18th bit. More...
 
virtual void  OutCodeword (int codeword)
  Utility method that adds a codeword to the barcode. More...
 
virtual void  OutStopPattern ()
  Adds the stop pattern to the output. More...
 
virtual void  OutStartPattern ()
  Adds the start pattern to the output. More...
 
virtual void  OutPaintCode ()
  Adds the barcode to the output bits. More...
 
virtual void  CalculateErrorCorrection (int dest)
  Calculates the error correction codewords. More...
 
virtual void  TextCompaction (int start, int length)
  Compacts the codewords. More...
 
virtual void  BasicNumberCompaction (int start, int length)
  Compacts the codewords. More...
 
virtual int  GetTextTypeAndValue (int maxLength, int idx)
  Gets the text type and value. More...
 
virtual bool  CheckSegmentType (BarcodePDF417.Segment segment, char type)
  Checks whether the segment is of a certain type. More...
 
virtual int  GetSegmentLength (BarcodePDF417.Segment segment)
  Calculates the length of the given segment More...
 
virtual void  NumberCompaction (int start, int length)
  Compacts the code words. More...
 
virtual void  ByteCompaction6 (int start)
  Compacts the code words More...
 
virtual void  Assemble ()
  Assembles the data of the code words. More...
 
virtual void  DumpList ()
  Prints the segments to standard output. More...
 
virtual int  GetMaxSquare ()
  Calculates the max square that can contain the barcode. More...
 

Static Package Functions

static int  MaxPossibleErrorLevel (int remain)
  Calculates the highest error level that can be used for the remaining number of data codewords. More...
 

Package Attributes

int  bitPtr
 
int  cwPtr
 
BarcodePDF417.SegmentList  segmentList
 

Static Package Attributes

const int  START_PATTERN = 0x1fea8
 
const int  STOP_PATTERN = 0x3fa29
 
const int  START_CODE_SIZE = 17
 
const int  STOP_SIZE = 18
 
const int  MOD = 929
 
const int  ALPHA = 0x10000
 
const int  LOWER = 0x20000
 
const int  MIXED = 0x40000
 
const int  PUNCTUATION = 0x80000
 
const int  ISBYTE = 0x100000
 
const int  BYTESHIFT = 913
 
const int  PL = 25
 
const int  LL = 27
 
const int  AS = 27
 
const int  ML = 28
 
const int  AL = 28
 
const int  PS = 29
 
const int  PAL = 29
 
const int  SPACE = 26
 
const int  TEXT_MODE = 900
 
const int  BYTE_MODE_6 = 924
 
const int  BYTE_MODE = 901
 
const int  NUMERIC_MODE = 902
 
const int  ABSOLUTE_MAX_TEXT_SIZE = 5420
 
const int  MAX_DATA_CODEWORDS = 926
 
const int  MACRO_SEGMENT_ID = 928
 
const int  MACRO_LAST_SEGMENT = 922
 
const float  DEFAUL_MODULE_WIDTH = 1
 
const float  DEFAUL_MODULE_HEIGHT = 1
 
- Static Package Attributes inherited from iText.Barcodes.Barcode2D
const float  DEFAULT_MODULE_SIZE = 1
 

Detailed Description

PDF417 is a stacked linear barcode format used in a variety of applications such as transport, identification cards, and inventory management.

PDF417 is a stacked linear barcode format used in a variety of applications such as transport, identification cards, and inventory management. "PDF" stands for Portable Data File. The "417" signifies that each pattern in the code consists of 4 bars and spaces in a pattern that is 17 units (modules) long. It is defined in ISO 15438.

Constructor & Destructor Documentation

◆ BarcodePDF417()

iText.Barcodes.BarcodePDF417.BarcodePDF417 ( )
inline

Creates a new BarcodePDF417 with the default settings.

Member Function Documentation

◆ Assemble()

virtual void iText.Barcodes.BarcodePDF417.Assemble ( )
inlinepackagevirtual

Assembles the data of the code words.

◆ BasicNumberCompaction()

virtual void iText.Barcodes.BarcodePDF417.BasicNumberCompaction ( int  start,
int  length 
)
inlinepackagevirtual

Compacts the codewords.

Parameters
start the start position
length the length

◆ ByteCompaction6()

virtual void iText.Barcodes.BarcodePDF417.ByteCompaction6 ( int  start )
inlinepackagevirtual

Compacts the code words

Parameters
start the start position

◆ CalculateErrorCorrection()

virtual void iText.Barcodes.BarcodePDF417.CalculateErrorCorrection ( int  dest )
inlinepackagevirtual

Calculates the error correction codewords.

Parameters
dest length of the code words

◆ CheckSegmentType()

virtual bool iText.Barcodes.BarcodePDF417.CheckSegmentType ( BarcodePDF417.Segment  segment,
char  type 
)
inlinepackagevirtual

Checks whether the segment is of a certain type.

Parameters
segment the segment to check
type the type to check against
Returns
true if the segment is of the specified type

◆ CreateFormXObject() [1/2]

virtual PdfFormXObject iText.Barcodes.BarcodePDF417.CreateFormXObject ( Color  foreground,
float  moduleWidth,
float  moduleHeight,
PdfDocument  document 
)
inlinevirtual

Creates a PdfFormXObject with the barcode with given module width and module height.

Parameters
foreground The color of the pixels. It can be null
moduleWidth The width of the pixels.
moduleHeight The height of the pixels.
document The document
Returns
the XObject.

◆ CreateFormXObject() [2/2]

override PdfFormXObject iText.Barcodes.BarcodePDF417.CreateFormXObject ( Color  foreground,
PdfDocument  document 
)
inlinevirtual

Creates a PdfFormXObject with the barcode.

Parameters
foreground the color of the pixels. It can be null
Returns
the XObject.

Implements iText.Barcodes.Barcode2D.

◆ DumpList()

virtual void iText.Barcodes.BarcodePDF417.DumpList ( )
inlinepackagevirtual

Prints the segments to standard output.

◆ GetAspectRatio()

virtual float iText.Barcodes.BarcodePDF417.GetAspectRatio ( )
inlinevirtual

Gets the barcode aspect ratio.

Returns
the barcode aspect ratio

◆ GetBarcodeSize()

override Rectangle iText.Barcodes.BarcodePDF417.GetBarcodeSize ( )
inlinevirtual

Gets the maximum area that the barcode and the text, if any, will occupy.

Implements iText.Barcodes.Barcode2D.

◆ GetBitColumns()

virtual int iText.Barcodes.BarcodePDF417.GetBitColumns ( )
inlinevirtual

Gets the number of X pixels of outBits.

Returns
the number of X pixels of outBits

◆ GetCode()

virtual byte [] iText.Barcodes.BarcodePDF417.GetCode ( )
inlinevirtual

Gets the bytes that form the barcode.

Gets the bytes that form the barcode. This bytes should be interpreted in the codepage Cp437.

Returns
the bytes that form the barcode

◆ GetCodeColumns()

virtual int iText.Barcodes.BarcodePDF417.GetCodeColumns ( )
inlinevirtual

Gets the number of barcode data columns.

Returns
he number of barcode data columns

◆ GetCodeRows()

virtual int iText.Barcodes.BarcodePDF417.GetCodeRows ( )
inlinevirtual

Gets the number of Y pixels of outBits.

Gets the number of Y pixels of outBits. It is also the number of rows in the barcode.

Returns
the number of Y pixels of outBits

◆ GetCodewords()

virtual int [] iText.Barcodes.BarcodePDF417.GetCodewords ( )
inlinevirtual

Gets the codeword array.

Gets the codeword array. This array is always 928 elements long. It can be written to if the option PDF417_USE_RAW_CODEWORDS is set.

Returns
the codeword array

◆ GetErrorLevel()

virtual int iText.Barcodes.BarcodePDF417.GetErrorLevel ( )
inlinevirtual

Gets the error level correction used for the barcode.

Gets the error level correction used for the barcode. It may different from the previously set value.

Returns
the error level correction used for the barcode

◆ GetLenCodewords()

virtual int iText.Barcodes.BarcodePDF417.GetLenCodewords ( )
inlinevirtual

Gets the length of the codewords.

Returns
the length of the codewords

◆ GetMaxSquare()

virtual int iText.Barcodes.BarcodePDF417.GetMaxSquare ( )
inlinepackagevirtual

Calculates the max square that can contain the barcode.

Calculates the max square that can contain the barcode. And sets the codeColumns and codeRows variables.

Returns
the max square that can contain the barcode

◆ GetOptions()

virtual int iText.Barcodes.BarcodePDF417.GetOptions ( )
inlinevirtual

Gets the options to generate the barcode.

Returns
the options to generate the barcode

◆ GetOutBits()

virtual byte [] iText.Barcodes.BarcodePDF417.GetOutBits ( )
inlinevirtual

Gets the raw image bits of the barcode.

Gets the raw image bits of the barcode. The image will have to be scaled in the Y direction by yHeight.

Returns
The raw barcode image

◆ GetSegmentLength()

virtual int iText.Barcodes.BarcodePDF417.GetSegmentLength ( BarcodePDF417.Segment  segment )
inlinepackagevirtual

Calculates the length of the given segment

Parameters
segment the segment to check
Returns
the length of the segment

◆ GetTextTypeAndValue()

virtual int iText.Barcodes.BarcodePDF417.GetTextTypeAndValue ( int  maxLength,
int  idx 
)
inlinepackagevirtual

Gets the text type and value.

Parameters
maxLength the maximum length
idx the index
Returns
the text type and value

◆ GetYHeight()

virtual float iText.Barcodes.BarcodePDF417.GetYHeight ( )
inlinevirtual

Gets the Y pixel height relative to X.

Returns
the Y pixel height relative to X

◆ MaxPossibleErrorLevel()

static int iText.Barcodes.BarcodePDF417.MaxPossibleErrorLevel ( int  remain )
inlinestaticpackage

Calculates the highest error level that can be used for the remaining number of data codewords.

Parameters
remain the number of data codewords
Returns
the highest error level that can be used

◆ NumberCompaction()

virtual void iText.Barcodes.BarcodePDF417.NumberCompaction ( int  start,
int  length 
)
inlinepackagevirtual

Compacts the code words.

Parameters
start the start position
length the length

◆ OutCodeword()

virtual void iText.Barcodes.BarcodePDF417.OutCodeword ( int  codeword )
inlinepackagevirtual

Utility method that adds a codeword to the barcode.

Parameters
codeword the codeword to add

◆ OutCodeword17()

virtual void iText.Barcodes.BarcodePDF417.OutCodeword17 ( int  codeword )
inlinepackagevirtual

Adds the code word to the correct code word to the 17th bit.

Parameters
codeword the code word

◆ OutCodeword18()

virtual void iText.Barcodes.BarcodePDF417.OutCodeword18 ( int  codeword )
inlinepackagevirtual

Adds the code word to the correct code word to the 18th bit.

Parameters
codeword the code word

◆ OutPaintCode()

virtual void iText.Barcodes.BarcodePDF417.OutPaintCode ( )
inlinepackagevirtual

Adds the barcode to the output bits.

◆ OutStartPattern()

virtual void iText.Barcodes.BarcodePDF417.OutStartPattern ( )
inlinepackagevirtual

Adds the start pattern to the output.

◆ OutStopPattern()

virtual void iText.Barcodes.BarcodePDF417.OutStopPattern ( )
inlinepackagevirtual

Adds the stop pattern to the output.

◆ PaintCode()

virtual void iText.Barcodes.BarcodePDF417.PaintCode ( )
inlinevirtual

Paints the barcode.

Paints the barcode. If no exception was thrown a valid barcode is available.

◆ PlaceBarcode() [1/2]

override Rectangle iText.Barcodes.BarcodePDF417.PlaceBarcode ( PdfCanvas  canvas,
Color  foreground 
)
inlinevirtual

Places the barcode in a PdfCanvas.

Implements iText.Barcodes.Barcode2D.

◆ PlaceBarcode() [2/2]

virtual Rectangle iText.Barcodes.BarcodePDF417.PlaceBarcode ( PdfCanvas  canvas,
Color  foreground,
float  moduleWidth,
float  moduleHeight 
)
inlinevirtual

Places the barcode in a iText.Kernel.Pdf.Canvas.PdfCanvas.

Parameters
canvas the iText.Kernel.Pdf.Canvas.PdfCanvas where the barcode will be placed
foreground the iText.Kernel.Colors.Color of the bars of the barcode
moduleWidth the width of the thinnest bar
moduleHeight the height of the bars
Returns
the dimensions the barcode occupies

◆ SetAspectRatio()

virtual void iText.Barcodes.BarcodePDF417.SetAspectRatio ( float  aspectRatio )
inlinevirtual

Sets the barcode aspect ratio.

Sets the barcode aspect ratio. A ratio or 0.5 will make the barcode width twice as large as the height.

Parameters
aspectRatio the barcode aspect ratio

◆ SetCode() [1/2]

virtual void iText.Barcodes.BarcodePDF417.SetCode ( byte[]  code )
inlinevirtual

Sets the bytes that form the barcode.

Sets the bytes that form the barcode. This bytes should be interpreted in the codepage Cp437.

Parameters
code the bytes that form the barcode

◆ SetCode() [2/2]

virtual void iText.Barcodes.BarcodePDF417.SetCode ( String  text )
inlinevirtual

Sets the code that will form the barcode.

Sets the code that will form the barcode. This text is converted to bytes using the encoding Cp437.

Parameters
text the text that will form the barcode

◆ SetCodeColumns()

virtual void iText.Barcodes.BarcodePDF417.SetCodeColumns ( int  codeColumns )
inlinevirtual

Sets the number of barcode data columns.

Sets the number of barcode data columns. This number may be changed to keep the barcode valid.

Parameters
codeColumns the number of barcode data columns

◆ SetCodeRows()

virtual void iText.Barcodes.BarcodePDF417.SetCodeRows ( int  codeRows )
inlinevirtual

Sets the number of barcode rows.

Sets the number of barcode rows. This number may be changed to keep the barcode valid.

Parameters
codeRows the number of barcode rows

◆ SetDefaultParameters()

virtual void iText.Barcodes.BarcodePDF417.SetDefaultParameters ( )
inlinevirtual

Set the default settings that correspond to PDF417_USE_ASPECT_RATIO and PDF417_AUTO_ERROR_LEVEL.

◆ SetErrorLevel()

virtual void iText.Barcodes.BarcodePDF417.SetErrorLevel ( int  errorLevel )
inlinevirtual

Sets the error level correction for the barcode.

Parameters
errorLevel the error level correction for the barcode

◆ SetLenCodewords()

virtual void iText.Barcodes.BarcodePDF417.SetLenCodewords ( int  lenCodewords )
inlinevirtual

Sets the length of the codewords.

Parameters
lenCodewords the length of the codewords

◆ SetMacroFileId()

virtual void iText.Barcodes.BarcodePDF417.SetMacroFileId ( String  id )
inlinevirtual

Sets the File ID for macro PDF417 encoding

Parameters
id the file id

◆ SetMacroSegmentCount()

virtual void iText.Barcodes.BarcodePDF417.SetMacroSegmentCount ( int  cnt )
inlinevirtual

Sets the segment count for macro PDF417 encoding

Parameters
cnt the number of macro segments
See also
SetMacroSegmentId(int)

◆ SetMacroSegmentId()

virtual void iText.Barcodes.BarcodePDF417.SetMacroSegmentId ( int  id )
inlinevirtual

Sets the segment id for macro PDF417 encoding

Parameters
id the id (starting at 0)
See also
SetMacroSegmentCount(int)

◆ SetOptions()

virtual void iText.Barcodes.BarcodePDF417.SetOptions ( int  options )
inlinevirtual

Sets the options to generate the barcode.

Sets the options to generate the barcode. This can be all the PDF417_* constants.

Parameters
options the options to generate the barcode

◆ SetYHeight()

virtual void iText.Barcodes.BarcodePDF417.SetYHeight ( float  yHeight )
inlinevirtual

Sets the Y pixel height relative to X.

Sets the Y pixel height relative to X. It is usually 3.

Parameters
yHeight the Y pixel height relative to X

◆ TextCompaction()

virtual void iText.Barcodes.BarcodePDF417.TextCompaction ( int  start,
int  length 
)
inlinepackagevirtual

Compacts the codewords.

Parameters
start the start position
length the length

Member Data Documentation

◆ PDF417_AUTO_ERROR_LEVEL

const int iText.Barcodes.BarcodePDF417.PDF417_AUTO_ERROR_LEVEL = 0
static

The error level correction is set automatically according to ISO 15438 recommendations.

◆ PDF417_FIXED_COLUMNS

const int iText.Barcodes.BarcodePDF417.PDF417_FIXED_COLUMNS = 2
static

The size will be at least codeColumns with a variable number of codeRows.

◆ PDF417_FIXED_RECTANGLE

const int iText.Barcodes.BarcodePDF417.PDF417_FIXED_RECTANGLE = 1
static

The size of the barcode will be at least codeColumns*codeRows.

◆ PDF417_FIXED_ROWS

const int iText.Barcodes.BarcodePDF417.PDF417_FIXED_ROWS = 4
static

The size will be at least codeRows with a variable number of codeColumns.

◆ PDF417_FORCE_BINARY

const int iText.Barcodes.BarcodePDF417.PDF417_FORCE_BINARY = 32
static

One single binary segment is used

◆ PDF417_INVERT_BITMAP

const int iText.Barcodes.BarcodePDF417.PDF417_INVERT_BITMAP = 128
static

Inverts the output bits of the raw bitmap that is normally bit one for black.

Inverts the output bits of the raw bitmap that is normally bit one for black. It has only effect for the raw bitmap.

◆ PDF417_USE_ASPECT_RATIO

const int iText.Barcodes.BarcodePDF417.PDF417_USE_ASPECT_RATIO = 0
static

Auto-size is made based on aspectRatio and yHeight.

◆ PDF417_USE_ERROR_LEVEL

const int iText.Barcodes.BarcodePDF417.PDF417_USE_ERROR_LEVEL = 16
static

The error level correction is set by the user.

The error level correction is set by the user. It can be 0 to 8.

◆ PDF417_USE_MACRO

const int iText.Barcodes.BarcodePDF417.PDF417_USE_MACRO = 256
static

Use Macro PDF417 Encoding

See also
SetMacroFileId(System.String), SetMacroSegmentId(int), SetMacroSegmentCount(int)

◆ PDF417_USE_RAW_CODEWORDS

const int iText.Barcodes.BarcodePDF417.PDF417_USE_RAW_CODEWORDS = 64
static

No text interpretation is done and the content of codewords is used directly.