iText 8.0.2 API
All Classes Namespaces Functions Variables Enumerations Enumerator Properties
iText.Barcodes.BarcodeMSI Class Reference

Implements the MSI Barcode. More...

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

Public Member Functions

  BarcodeMSI (PdfDocument document)
  Creates a new BarcodeMSI. More...
 
  BarcodeMSI (PdfDocument document, PdfFont font)
  Creates a new BarcodeMSI 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...
 
- 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 ()
 
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 void  SetCode (String code)
  Sets 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 byte[]  GetBarsMSI (String text)
  Creates the bars. More...
 
static int  GetChecksum (String text)
  Calculates the mod 10 checksum digit using the Luhn algorithm. More...
 

Additional Inherited Members

- Static Public Attributes inherited from iText.Barcodes.Barcode1D
const int  ALIGN_LEFT = 1
 
const int  ALIGN_RIGHT = 2
 
const int  ALIGN_CENTER = 3
 

Detailed Description

Implements the MSI Barcode.

Implements the MSI Barcode. The code may only contain numeric characters. The getChecksum method returns the mod 10 checksum digit which is the most widely used for MSI barcodes.

Constructor & Destructor Documentation

◆ BarcodeMSI() [1/2]

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

Creates a new BarcodeMSI.

Creates a new BarcodeMSI. 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 BarcodeMSI(iText.Kernel.Pdf.PdfDocument, iText.Kernel.Font.PdfFont).

Parameters
document The document to which the barcode will be added

◆ BarcodeMSI() [2/2]

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

Creates a new BarcodeMSI

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

Member Function Documentation

◆ GetBarcodeSize()

override Rectangle iText.Barcodes.BarcodeMSI.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.

◆ GetBarsMSI()

static byte [] iText.Barcodes.BarcodeMSI.GetBarsMSI ( String  text )
inlinestatic

Creates the bars.

Parameters
text the text to create the bars.
Returns
the bars

◆ GetChecksum()

static int iText.Barcodes.BarcodeMSI.GetChecksum ( String  text )
inlinestatic

Calculates the mod 10 checksum digit using the Luhn algorithm.

Parameters
text the barcode data
Returns
the checksum digit

◆ PlaceBarcode()

override Rectangle iText.Barcodes.BarcodeMSI.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.