iText 8.0.5 API
iText.Barcodes.Barcode1D Class Referenceabstract

Base class for the barcode types that have 1D representation. More...

Inheritance diagram for iText.Barcodes.Barcode1D:
iText.Barcodes.Barcode128 iText.Barcodes.Barcode39 iText.Barcodes.BarcodeCodabar iText.Barcodes.BarcodeEAN iText.Barcodes.BarcodeEANSUPP iText.Barcodes.BarcodeInter25 iText.Barcodes.BarcodeMSI iText.Barcodes.BarcodePostnet

Public Member Functions

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 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...
 
abstract Rectangle  GetBarcodeSize ()
  Gets the maximum area that the barcode and the text, if any, will occupy. More...
 
abstract Rectangle  PlaceBarcode (PdfCanvas canvas, Color barColor, Color textColor)
  Places the barcode in a PdfCanvas. 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 Attributes

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...
 

Package Functions

  Barcode1D (PdfDocument document)
  Creates new Barcode1D instance. More...
 
virtual float  GetDescender ()
  Gets the descender value of the font. More...
 

Package Attributes

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

Base class for the barcode types that have 1D representation.

Base class for the barcode types that have 1D representation. This means all data is encoded in the width of the bars. And the height of the bars is constant.

Constructor & Destructor Documentation

◆ Barcode1D()

iText.Barcodes.Barcode1D.Barcode1D ( PdfDocument  document )
inlinepackage

Creates new Barcode1D instance.

Parameters
document The document

Member Function Documentation

◆ CreateFormXObject() [1/2]

virtual PdfFormXObject iText.Barcodes.Barcode1D.CreateFormXObject ( Color  barColor,
Color  textColor,
PdfDocument  document 
)
inlinevirtual

Creates a PdfFormXObject with the barcode.

Parameters
barColor The color of the bars. It can be null
textColor The color of the text. It can be null
document The document
Returns
the XObject
See also
PlaceBarcode(iText.Kernel.Pdf.Canvas.PdfCanvas, iText.Kernel.Colors.Color, iText.Kernel.Colors.Color)

◆ CreateFormXObject() [2/2]

virtual PdfFormXObject iText.Barcodes.Barcode1D.CreateFormXObject ( PdfDocument  document )
inlinevirtual

Creates a PdfFormXObject with the barcode.

Creates a PdfFormXObject with the barcode. Default bar color and text color will be used.

Parameters
document The document
Returns
The XObject
See also
CreateFormXObject(iText.Kernel.Colors.Color, iText.Kernel.Colors.Color, iText.Kernel.Pdf.PdfDocument)

◆ FitWidth()

virtual void iText.Barcodes.Barcode1D.FitWidth ( float  width )
inlinevirtual

Make the barcode occupy the specified width.

Make the barcode occupy the specified width. Usually this is achieved by adjusting bar widths.

Parameters
width The width

Reimplemented in iText.Barcodes.BarcodePostnet.

◆ GetAltText()

virtual String iText.Barcodes.Barcode1D.GetAltText ( )
inlinevirtual

Gets the alternate text.

Returns
the alternate text

◆ GetBarcodeSize()

abstract Rectangle iText.Barcodes.Barcode1D.GetBarcodeSize ( )
pure virtual

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.

Implemented in iText.Barcodes.BarcodeEAN, iText.Barcodes.Barcode128, iText.Barcodes.Barcode39, iText.Barcodes.BarcodeCodabar, iText.Barcodes.BarcodeInter25, iText.Barcodes.BarcodeMSI, iText.Barcodes.BarcodePostnet, and iText.Barcodes.BarcodeEANSUPP.

◆ GetBarHeight()

virtual float iText.Barcodes.Barcode1D.GetBarHeight ( )
inlinevirtual

Gets the height of the bars.

Returns
the height of the bars

◆ GetBaseline()

virtual float iText.Barcodes.Barcode1D.GetBaseline ( )
inlinevirtual

Gets the text baseline.

Gets the text baseline. If positive, the text distance under the bars. If zero or negative, the text distance above the bars.

Returns
the baseline.

◆ GetCode()

virtual String iText.Barcodes.Barcode1D.GetCode ( )
inlinevirtual

Gets the code to generate.

Returns
the code to generate

◆ GetCodeType()

virtual int iText.Barcodes.Barcode1D.GetCodeType ( )
inlinevirtual

Gets the code type.

Returns
the code type

◆ GetDescender()

virtual float iText.Barcodes.Barcode1D.GetDescender ( )
inlinepackagevirtual

Gets the descender value of the font.

Returns
the descender value of the font

◆ GetFont()

virtual PdfFont iText.Barcodes.Barcode1D.GetFont ( )
inlinevirtual

Gets the text font.

Gets the text font. null if no text.

Returns
the text font. null if no text

◆ GetInkSpreading()

virtual float iText.Barcodes.Barcode1D.GetInkSpreading ( )
inlinevirtual

Gets the amount of ink spreading.

Returns
the ink spreading

◆ GetN()

virtual float iText.Barcodes.Barcode1D.GetN ( )
inlinevirtual

Gets the bar multiplier for wide bars.

Returns
the bar multiplier for wide bars

◆ GetSize()

virtual float iText.Barcodes.Barcode1D.GetSize ( )
inlinevirtual

Gets the size of the text.

Returns
the size

◆ GetTextAlignment()

virtual int iText.Barcodes.Barcode1D.GetTextAlignment ( )
inlinevirtual

Gets the text alignment.

Returns
the text alignment

◆ GetX()

virtual float iText.Barcodes.Barcode1D.GetX ( )
inlinevirtual

Gets the minimum bar width.

Returns
the minimum bar width

◆ IsChecksumText()

virtual bool iText.Barcodes.Barcode1D.IsChecksumText ( )
inlinevirtual

Gets the property to show the generated checksum in the the text.

Returns
value of property checksumText

◆ IsExtended()

virtual bool iText.Barcodes.Barcode1D.IsExtended ( )
inlinevirtual

Gets the property to generate extended barcode 39.

Returns
value of property extended.

◆ IsGenerateChecksum()

virtual bool iText.Barcodes.Barcode1D.IsGenerateChecksum ( )
inlinevirtual

Gets the optional checksum generation.

Returns
the optional checksum generation

◆ IsGuardBars()

virtual bool iText.Barcodes.Barcode1D.IsGuardBars ( )
inlinevirtual

Gets the property to show the guard bars for barcode EAN.

Returns
value of property guardBars

◆ IsStartStopText()

virtual bool iText.Barcodes.Barcode1D.IsStartStopText ( )
inlinevirtual

Sets the property to show the start and stop character '*' in the text for the barcode 39.

Returns
value of property startStopText

◆ PlaceBarcode()

abstract Rectangle iText.Barcodes.Barcode1D.PlaceBarcode ( PdfCanvas  canvas,
Color  barColor,
Color  textColor 
)
pure virtual

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

Implemented in iText.Barcodes.BarcodeEAN, iText.Barcodes.Barcode128, iText.Barcodes.Barcode39, iText.Barcodes.BarcodeCodabar, iText.Barcodes.BarcodeInter25, iText.Barcodes.BarcodeMSI, iText.Barcodes.BarcodeEANSUPP, and iText.Barcodes.BarcodePostnet.

◆ SetAltText()

virtual void iText.Barcodes.Barcode1D.SetAltText ( String  altText )
inlinevirtual

Sets the alternate text.

Sets the alternate text. If present, this text will be used instead of the text derived from the supplied code.

Parameters
altText the alternate text

◆ SetBarHeight()

virtual void iText.Barcodes.Barcode1D.SetBarHeight ( float  barHeight )
inlinevirtual

Sets the height of the bars.

Parameters
barHeight the height of the bars

◆ SetBaseline()

virtual void iText.Barcodes.Barcode1D.SetBaseline ( float  baseline )
inlinevirtual

Sets the text baseline.

Sets the text baseline. If positive, the text distance under the bars. If zero or negative, the text distance above the bars.

Parameters
baseline the baseline.

◆ SetChecksumText()

virtual void iText.Barcodes.Barcode1D.SetChecksumText ( bool  checksumText )
inlinevirtual

Sets the property to show the generated checksum in the the text.

Parameters
checksumText new value of property checksumText

◆ SetCode()

virtual void iText.Barcodes.Barcode1D.SetCode ( String  code )
inlinevirtual

Sets the code to generate.

Parameters
code the code to generate

Reimplemented in iText.Barcodes.Barcode128.

◆ SetCodeType()

virtual void iText.Barcodes.Barcode1D.SetCodeType ( int  codeType )
inlinevirtual

Sets the code type.

Parameters
codeType the code type

◆ SetExtended()

virtual void iText.Barcodes.Barcode1D.SetExtended ( bool  extended )
inlinevirtual

Sets the property to generate extended barcode 39.

Parameters
extended new value of property extended

◆ SetFont()

virtual void iText.Barcodes.Barcode1D.SetFont ( PdfFont  font )
inlinevirtual

Sets the text font.

Parameters
font the text font. Set to null to suppress any text

◆ SetGenerateChecksum()

virtual void iText.Barcodes.Barcode1D.SetGenerateChecksum ( bool  generateChecksum )
inlinevirtual

Setter for property generateChecksum.

Parameters
generateChecksum New value of property generateChecksum.

◆ SetGuardBars()

virtual void iText.Barcodes.Barcode1D.SetGuardBars ( bool  guardBars )
inlinevirtual

Sets the property to show the guard bars for barcode EAN.

Parameters
guardBars new value of property guardBars

◆ SetInkSpreading()

virtual void iText.Barcodes.Barcode1D.SetInkSpreading ( float  inkSpreading )
inlinevirtual

Sets the amount of ink spreading.

Sets the amount of ink spreading. This value will be subtracted to the width of each bar. The actual value will depend on the ink and the printing medium.

Parameters
inkSpreading the ink spreading

◆ SetN()

virtual void iText.Barcodes.Barcode1D.SetN ( float  n )
inlinevirtual

Sets the bar multiplier for wide bars.

Parameters
n the bar multiplier for wide bars

◆ SetSize()

virtual void iText.Barcodes.Barcode1D.SetSize ( float  size )
inlinevirtual

Sets the size of the text.

Parameters
size the size of the text

◆ SetStartStopText()

virtual void iText.Barcodes.Barcode1D.SetStartStopText ( bool  startStopText )
inlinevirtual

Gets the property to show the start and stop character '*' in the text for the barcode 39.

Parameters
startStopText new value of property startStopText

◆ SetTextAlignment()

virtual void iText.Barcodes.Barcode1D.SetTextAlignment ( int  textAlignment )
inlinevirtual

Sets the text alignment.

Parameters
textAlignment the text alignment

◆ SetX()

virtual void iText.Barcodes.Barcode1D.SetX ( float  x )
inlinevirtual

Sets the minimum bar width.

Parameters
x the minimum bar width

Member Data Documentation

◆ ALIGN_CENTER

const int iText.Barcodes.Barcode1D.ALIGN_CENTER = 3
static

Constant that defines center alignment.

◆ ALIGN_LEFT

const int iText.Barcodes.Barcode1D.ALIGN_LEFT = 1
static

Constant that defines left alignment.

◆ ALIGN_RIGHT

const int iText.Barcodes.Barcode1D.ALIGN_RIGHT = 2
static

Constant that defines right alignment.

◆ altText

String iText.Barcodes.Barcode1D.altText
package

The alternate text to be used, if present.

◆ barHeight

float iText.Barcodes.Barcode1D.barHeight
package

The height of the bars.

◆ baseline

float iText.Barcodes.Barcode1D.baseline
package

If positive, the text distance under the bars.

If positive, the text distance under the bars. If zero or negative, the text distance above the bars.

◆ checksumText

bool iText.Barcodes.Barcode1D.checksumText
package

Shows the generated checksum in the the text.

◆ code

String iText.Barcodes.Barcode1D.code = ""
package

The code to generate.

◆ codeType

int iText.Barcodes.Barcode1D.codeType
package

The code type.

◆ extended

bool iText.Barcodes.Barcode1D.extended
package

Generates extended barcode 39.

◆ font

PdfFont iText.Barcodes.Barcode1D.font
package

The text font.

The text font. null if no text.

◆ generateChecksum

bool iText.Barcodes.Barcode1D.generateChecksum
package

The optional checksum generation.

◆ guardBars

bool iText.Barcodes.Barcode1D.guardBars
package

Show the guard bars for barcode EAN.

◆ inkSpreading

float iText.Barcodes.Barcode1D.inkSpreading = 0
package

The ink spreading.

◆ n

float iText.Barcodes.Barcode1D.n
package

The bar multiplier for wide bars or the distance between bars for Postnet and Planet.

◆ size

float iText.Barcodes.Barcode1D.size
package

The size of the text or the height of the shorter bar in Postnet.

◆ startStopText

bool iText.Barcodes.Barcode1D.startStopText
package

Show the start and stop character '*' in the text for the barcode 39 or 'ABCD' for codabar.

◆ textAlignment

int iText.Barcodes.Barcode1D.textAlignment
package

The text alignment.

◆ x

float iText.Barcodes.Barcode1D.x
package

The minimum bar width.