Class Barcode
- Namespace
- iTextSharp.text.pdf
- Assembly
- iTextSharp.LGPLv2.Core.dll
Base class containing properties and methods commom to all barcode types. @author Paulo Soares (psoares@consiste.pt)
public abstract class Barcode
- Inheritance
-
Barcode
- Derived
- Inherited Members
Constructors
Barcode()
protected Barcode()
Fields
CODABAR
A type of barcode
public const int CODABAR = 12
Field Value
CODE128
A type of barcode
public const int CODE128 = 9
Field Value
CODE128_RAW
A type of barcode
public const int CODE128_RAW = 11
Field Value
CODE128_UCC
A type of barcode
public const int CODE128_UCC = 10
Field Value
EAN13
A type of barcode
public const int EAN13 = 1
Field Value
EAN8
A type of barcode
public const int EAN8 = 2
Field Value
PLANET
A type of barcode
public const int PLANET = 8
Field Value
POSTNET
A type of barcode
public const int POSTNET = 7
Field Value
SUPP2
A type of barcode
public const int SUPP2 = 5
Field Value
SUPP5
A type of barcode
public const int SUPP5 = 6
Field Value
UPCA
A type of barcode
public const int UPCA = 3
Field Value
UPCE
A type of barcode
public const int UPCE = 4
Field Value
altText
The alternate text to be used, if present.
protected string altText
Field Value
barHeight
The height of the bars.
protected float barHeight
Field Value
baseline
If positive, the text distance under the bars. If zero or negative, the text distance above the bars.
protected float baseline
Field Value
checksumText
Shows the generated checksum in the the text.
protected bool checksumText
Field Value
code
The code to generate.
protected string code
Field Value
codeType
The code type.
protected int codeType
Field Value
extended
Generates extended barcode 39.
protected bool extended
Field Value
font
The text font. null if no text.
protected BaseFont font
Field Value
generateChecksum
The optional checksum generation.
protected bool generateChecksum
Field Value
guardBars
Show the guard bars for barcode EAN.
protected bool guardBars
Field Value
inkSpreading
The ink spreading.
protected float inkSpreading
Field Value
n
The bar multiplier for wide bars or the distance between bars for Postnet and Planet.
protected float n
Field Value
size
The size of the text or the height of the shorter bar in Postnet.
protected float size
Field Value
startStopText
Show the start and stop character '*' in the text for the barcode 39 or 'ABCD' for codabar.
protected bool startStopText
Field Value
textAlignment
The text Element. Can be Element.ALIGN_LEFT , Element.ALIGN_CENTER or Element.ALIGN_RIGHT .
protected int textAlignment
Field Value
x
The minimum bar width.
protected float x
Field Value
Properties
AltText
Sets the alternate text. If present, this text will be used instead of the text derived from the supplied code.
public string AltText { get; set; }
Property Value
BarHeight
Gets the height of the bars.
public float BarHeight { get; set; }
Property Value
- float
the height of the bars
BarcodeSize
Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0).
public abstract Rectangle BarcodeSize { get; }
Property Value
- Rectangle
the size the barcode occupies.
Baseline
Gets the text baseline. If positive, the text distance under the bars. If zero or negative, the text distance above the bars.
public float Baseline { get; set; }
Property Value
- float
the baseline.
ChecksumText
Sets the property to show the generated checksum in the the text.
public bool ChecksumText { get; set; }
Property Value
Code
Gets the code to generate.
public virtual string Code { get; set; }
Property Value
- string
the code to generate
CodeType
Gets the code type.
public int CodeType { get; set; }
Property Value
- int
the code type
Extended
Sets the property to generate extended barcode 39.
public bool Extended { get; set; }
Property Value
Font
Gets the text font. null if no text.
public BaseFont Font { get; set; }
Property Value
- BaseFont
the text font. null if no text
GenerateChecksum
The property for the optional checksum generation.
public bool GenerateChecksum { get; set; }
Property Value
GuardBars
Sets the property to show the guard bars for barcode EAN.
public bool GuardBars { get; set; }
Property Value
InkSpreading
public float InkSpreading { get; set; }
Property Value
N
Gets the bar multiplier for wide bars.
public float N { get; set; }
Property Value
- float
the bar multiplier for wide bars
Size
Gets the size of the text.
public float Size { get; set; }
Property Value
- float
the size of the text
StartStopText
Gets the property to show the start and stop character '*' in the text for the barcode 39.
public bool StartStopText { get; set; }
Property Value
TextAlignment
Gets the text Element. Can be Element.ALIGN_LEFT , Element.ALIGN_CENTER or Element.ALIGN_RIGHT .
public int TextAlignment { get; set; }
Property Value
- int
the text alignment
X
Gets the minimum bar width.
public float X { get; set; }
Property Value
- float
the minimum bar width
Methods
CreateDrawingImage(Color, Color)
public abstract SKBitmap CreateDrawingImage(Color foreground, Color background)
Parameters
Returns
- SKBitmap
CreateImageWithBarcode(PdfContentByte, BaseColor, BaseColor)
Creates an Image with the barcode. serves no other use @see #placeBarcode(PdfContentByte cb, Color barColor, Color textColor)
public Image CreateImageWithBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
Parameters
cb
PdfContentBytethe PdfContentByte to create the Image . It
barColor
BaseColorthe color of the bars. It can be null
textColor
BaseColorthe color of the text. It can be null
Returns
- Image
the Image
CreateTemplateWithBarcode(PdfContentByte, BaseColor, BaseColor)
Creates a template with the barcode. serves no other use @see #placeBarcode(PdfContentByte cb, Color barColor, Color textColor)
public PdfTemplate CreateTemplateWithBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
Parameters
cb
PdfContentBytethe PdfContentByte to create the template. It
barColor
BaseColorthe color of the bars. It can be null
textColor
BaseColorthe color of the text. It can be null
Returns
- PdfTemplate
the template
PlaceBarcode(PdfContentByte, BaseColor, BaseColor)
Places the barcode in a PdfContentByte . The barcode is always placed at coodinates (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
public abstract Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
Parameters
cb
PdfContentBytethe PdfContentByte where the barcode will be placed
barColor
BaseColorthe color of the bars. It can be null
textColor
BaseColorthe color of the text. It can be null
Returns
- Rectangle
the dimensions the barcode occupies