iText 8.0.5 API
iText.Barcodes.Barcode128 Class Reference

BarCode 128 is a high-density linear barcode symbology defined in ISO/IEC 15417:2007. More...

Inheritance diagram for iText.Barcodes.Barcode128:
iText.Barcodes.Barcode1D

Public Types

enum   Barcode128CodeSet { A, B, C, AUTO }
  The code set to be used to start encoding. More...
 

Public Member Functions

  Barcode128 (PdfDocument document)
  Creates new Barcode128. More...
 
  Barcode128 (PdfDocument document, PdfFont font)
  Creates new Barcode128, which will use the provided font More...
 
virtual void  SetCodeSet (Barcode128.Barcode128CodeSet codeSet)
  Sets the code set to use. More...
 
virtual Barcode128.Barcode128CodeSet  GetCodeSet ()
  Get the code set that is used. 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 barColor, Color textColor)
  Places the barcode in a PdfCanvas. More...
 
override void  SetCode (String code)
  Sets the code to generate. More...
 
- Public Member Functions inherited from iText.Barcodes.Barcode1D
virtual float  GetX ()
  Gets the minimum bar width. More...
 
virtual void  SetX (float x)
  Sets the minimum bar width. More...
 
virtual float  GetN ()
  Gets the bar multiplier for wide bars. More...
 
virtual void  SetN (float n)
  Sets the bar multiplier for wide bars. More...
 
virtual PdfFont  GetFont ()
  Gets the text font. More...
 
virtual void  SetFont (PdfFont font)
  Sets the text font. More...
 
virtual float  GetSize ()
  Gets the size of the text. More...
 
virtual void  SetSize (float size)
  Sets the size of the text. More...
 
virtual float  GetBaseline ()
  Gets the text baseline. More...
 
virtual void  SetBaseline (float baseline)
  Sets the text baseline. More...
 
virtual float  GetBarHeight ()
  Gets the height of the bars. More...
 
virtual void  SetBarHeight (float barHeight)
  Sets the height of the bars. More...
 
virtual int  GetTextAlignment ()
  Gets the text alignment. More...
 
virtual void  SetTextAlignment (int textAlignment)
  Sets the text alignment. More...
 
virtual bool  IsGenerateChecksum ()
  Gets the optional checksum generation. More...
 
virtual void  SetGenerateChecksum (bool generateChecksum)
  Setter for property generateChecksum. More...
 
virtual bool  IsChecksumText ()
  Gets the property to show the generated checksum in the the text. More...
 
virtual void  SetChecksumText (bool checksumText)
  Sets the property to show the generated checksum in the the text. More...
 
virtual bool  IsStartStopText ()
  Sets the property to show the start and stop character '*' in the text for the barcode 39. More...
 
virtual void  SetStartStopText (bool startStopText)
  Gets the property to show the start and stop character '*' in the text for the barcode 39. More...
 
virtual bool  IsExtended ()
  Gets the property to generate extended barcode 39. More...
 
virtual void  SetExtended (bool extended)
  Sets the property to generate extended barcode 39. More...
 
virtual String  GetCode ()
  Gets the code to generate. More...
 
virtual bool  IsGuardBars ()
  Gets the property to show the guard bars for barcode EAN. More...
 
virtual void  SetGuardBars (bool guardBars)
  Sets the property to show the guard bars for barcode EAN. More...
 
virtual int  GetCodeType ()
  Gets the code type. More...
 
virtual void  SetCodeType (int codeType)
  Sets the code type. More...
 
virtual float  GetInkSpreading ()
  Gets the amount of ink spreading. More...
 
virtual void  SetInkSpreading (float inkSpreading)
  Sets the amount of ink spreading. More...
 
virtual String  GetAltText ()
  Gets the alternate text. More...
 
virtual void  SetAltText (String altText)
  Sets the alternate text. More...
 
virtual PdfFormXObject  CreateFormXObject (PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 
virtual PdfFormXObject  CreateFormXObject (Color barColor, Color textColor, PdfDocument document)
  Creates a PdfFormXObject with the barcode. More...
 
virtual void  FitWidth (float width)
  Make the barcode occupy the specified width. More...
 

Static Public Member Functions

static String  RemoveFNC1 (String code)
  Removes the FNC1 codes in the text. More...
 
static String  GetHumanReadableUCCEAN (String code)
  Gets the human readable text of a sequence of AI. More...
 
static String  GetRawText (String text, bool ucc, Barcode128.Barcode128CodeSet codeSet)
  Converts the human readable text to the characters needed to create a barcode using the specified code set. More...
 
static String  GetRawText (String text, bool ucc)
  Converts the human readable text to the characters needed to create a barcode. More...
 
static byte[]  GetBarsCode128Raw (String text)
  Generates the bars. More...
 

Static Public Attributes

const int  CODE128 = 1
  A type of barcode More...
 
const int  CODE128_UCC = 2
  A type of barcode More...
 
const int  CODE128_RAW = 3
  A type of barcode More...
 
const char  CODE_AB_TO_C = (char)99
  The charset code change. More...
 
const char  CODE_AC_TO_B = (char)100
  The charset code change. More...
 
const char  CODE_BC_TO_A = (char)101
  The charset code change. More...
 
const char  FNC1_INDEX = (char)102
  The code for UCC/EAN-128. More...
 
const char  START_A = (char)103
  The start code. More...
 
const char  START_B = (char)104
  The start code. More...
 
const char  START_C = (char)105
  The start code. More...
 
const char  FNC1 = '\u00ca'
 
const char  DEL = '\u00c3'
 
const char  FNC3 = '\u00c4'
 
const char  FNC2 = '\u00c5'
 
const char  SHIFT = '\u00c6'
 
const char  CODE_C = '\u00c7'
 
const char  CODE_A = '\u00c8'
 
const char  FNC4 = '\u00c8'
 
const char  STARTA = '\u00cb'
 
const char  STARTB = '\u00cc'
 
const char  STARTC = '\u00cd'
 
- Static Public Attributes inherited from iText.Barcodes.Barcode1D
const int  ALIGN_LEFT = 1
  Constant that defines left alignment. More...
 
const int  ALIGN_RIGHT = 2
  Constant that defines right alignment. More...
 
const int  ALIGN_CENTER = 3
  Constant that defines center alignment. More...
 

Additional Inherited Members

- Package Functions inherited from iText.Barcodes.Barcode1D
  Barcode1D (PdfDocument document)
  Creates new Barcode1D instance. More...
 
virtual float  GetDescender ()
  Gets the descender value of the font. More...
 
- Package Attributes inherited from iText.Barcodes.Barcode1D
PdfDocument  document
 
float  x
  The minimum bar width. More...
 
float  n
  The bar multiplier for wide bars or the distance between bars for Postnet and Planet. More...
 
PdfFont  font
  The text font. More...
 
float  size
  The size of the text or the height of the shorter bar in Postnet. More...
 
float  baseline
  If positive, the text distance under the bars. More...
 
float  barHeight
  The height of the bars. More...
 
int  textAlignment
  The text alignment. More...
 
bool  generateChecksum
  The optional checksum generation. More...
 
bool  checksumText
  Shows the generated checksum in the the text. More...
 
bool  startStopText
  Show the start and stop character '*' in the text for the barcode 39 or 'ABCD' for codabar. More...
 
bool  extended
  Generates extended barcode 39. More...
 
String  code = ""
  The code to generate. More...
 
bool  guardBars
  Show the guard bars for barcode EAN. More...
 
int  codeType
  The code type. More...
 
float  inkSpreading = 0
  The ink spreading. More...
 
String  altText
  The alternate text to be used, if present. More...
 

Detailed Description

BarCode 128 is a high-density linear barcode symbology defined in ISO/IEC 15417:2007.

BarCode 128 is a high-density linear barcode symbology defined in ISO/IEC 15417:2007. It is used for alphanumeric or numeric-only barcodes. It can encode all 128 characters of ASCII

Member Enumeration Documentation

◆ Barcode128CodeSet

The code set to be used to start encoding.

Constructor & Destructor Documentation

◆ Barcode128() [1/2]

iText.Barcodes.Barcode128.Barcode128 ( PdfDocument  document )
inline

Creates new Barcode128.

Creates new Barcode128. To generate the font the iText.Kernel.Pdf.PdfDocument.GetDefaultFont() will be implicitly called. If you want to use this barcode in PDF/A documents, please consider using Barcode128(iText.Kernel.Pdf.PdfDocument, iText.Kernel.Font.PdfFont).

Parameters
document The document to which the barcode will be added

◆ Barcode128() [2/2]

iText.Barcodes.Barcode128.Barcode128 ( PdfDocument  document,
PdfFont  font 
)
inline

Creates new Barcode128, which will use the provided font

Parameters
document The document to which the barcode will be added
font The font to use

Member Function Documentation

◆ GetBarcodeSize()

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

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

Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0).

Returns
the size the barcode occupies.

Implements iText.Barcodes.Barcode1D.

◆ GetBarsCode128Raw()

static byte [] iText.Barcodes.Barcode128.GetBarsCode128Raw ( String  text )
inlinestatic

Generates the bars.

Generates the bars. The input has the actual barcodes, not the human readable text.

Parameters
text the barcode
Returns
the bars

◆ GetCodeSet()

virtual Barcode128.Barcode128CodeSet iText.Barcodes.Barcode128.GetCodeSet ( )
inlinevirtual

Get the code set that is used.

Returns
the code set.

◆ GetHumanReadableUCCEAN()

static String iText.Barcodes.Barcode128.GetHumanReadableUCCEAN ( String  code )
inlinestatic

Gets the human readable text of a sequence of AI.

Parameters
code the text
Returns
the human readable text

◆ GetRawText() [1/2]

static String iText.Barcodes.Barcode128.GetRawText ( String  text,
bool  ucc 
)
inlinestatic

Converts the human readable text to the characters needed to create a barcode.

Converts the human readable text to the characters needed to create a barcode. Some optimization is done to get the shortest code.

Parameters
text the text to convert
ucc true if it is an UCC/EAN-128. In this case the character FNC1 is added
Returns
the code ready to be fed to getBarsCode128Raw()

◆ GetRawText() [2/2]

static String iText.Barcodes.Barcode128.GetRawText ( String  text,
bool  ucc,
Barcode128.Barcode128CodeSet  codeSet 
)
inlinestatic

Converts the human readable text to the characters needed to create a barcode using the specified code set.

Parameters
text the text to convert
ucc true if it is an UCC/EAN-128. In this case the character FNC1 is added
codeSet forced code set, or AUTO for optimized barcode.
Returns
the code ready to be fed to getBarsCode128Raw()

◆ PlaceBarcode()

override Rectangle iText.Barcodes.Barcode128.PlaceBarcode ( PdfCanvas  canvas,
Color  barColor,
Color  textColor 
)
inlinevirtual

Places the barcode in a PdfCanvas.

Places the barcode in a PdfCanvas. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.

The bars and text are written in the following colors:

barColor textColor Result
null null bars and text painted with current fill color
barColor null bars and text painted with barColor
null textColor bars painted with current color
text painted with textColor
barColor textColor bars painted with barColor
text painted with textColor
Parameters
canvas the PdfCanvas where the barcode will be placed
barColor the color of the bars. It can be null
textColor the color of the text. It can be null
Returns
the dimensions the barcode occupies

Implements iText.Barcodes.Barcode1D.

◆ RemoveFNC1()

static String iText.Barcodes.Barcode128.RemoveFNC1 ( String  code )
inlinestatic

Removes the FNC1 codes in the text.

Parameters
code The text to clean
Returns
The cleaned text

◆ SetCode()

override void iText.Barcodes.Barcode128.SetCode ( String  code )
inlinevirtual

Sets the code to generate.

Sets the code to generate. If it's an UCC code and starts with '(' it will be split by the AI. This code in UCC mode is valid:
(01)00000090311314(10)ABC123(15)060916

Parameters
code the code to generate

Reimplemented from iText.Barcodes.Barcode1D.

◆ SetCodeSet()

virtual void iText.Barcodes.Barcode128.SetCodeSet ( Barcode128.Barcode128CodeSet  codeSet )
inlinevirtual

Sets the code set to use.

Parameters
codeSet the code set to use.

Member Data Documentation

◆ CODE128

const int iText.Barcodes.Barcode128.CODE128 = 1
static

A type of barcode

◆ CODE128_RAW

const int iText.Barcodes.Barcode128.CODE128_RAW = 3
static

A type of barcode

◆ CODE128_UCC

const int iText.Barcodes.Barcode128.CODE128_UCC = 2
static

A type of barcode

◆ CODE_AB_TO_C

const char iText.Barcodes.Barcode128.CODE_AB_TO_C = (char)99
static

The charset code change.

◆ CODE_AC_TO_B

const char iText.Barcodes.Barcode128.CODE_AC_TO_B = (char)100
static

The charset code change.

◆ CODE_BC_TO_A

const char iText.Barcodes.Barcode128.CODE_BC_TO_A = (char)101
static

The charset code change.

◆ FNC1_INDEX

const char iText.Barcodes.Barcode128.FNC1_INDEX = (char)102
static

The code for UCC/EAN-128.

◆ START_A

const char iText.Barcodes.Barcode128.START_A = (char)103
static

The start code.

◆ START_B

const char iText.Barcodes.Barcode128.START_B = (char)104
static

The start code.

◆ START_C

const char iText.Barcodes.Barcode128.START_C = (char)105
static

The start code.