Class BarcodeEan
- Namespace
- iTextSharp.text.pdf
- Assembly
- iTextSharp.LGPLv2.Core.dll
Generates barcodes in several formats: EAN13, EAN8, UPCA, UPCE, supplemental 2 and 5. The default parameters are: x = 0.8f; font = BaseFont.CreateFont("Helvetica", "winansi", false); size = 8; baseline = size; barHeight = size * 3; guardBars = true; codeType = EAN13; code = ""; @author Paulo Soares (psoares@consiste.pt)
public class BarcodeEan : Barcode
- Inheritance
-
BarcodeEan
- Inherited Members
Constructors
BarcodeEan()
Creates new BarcodeEAN
public BarcodeEan()
Properties
BarcodeSize
Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0).
public override Rectangle BarcodeSize { get; }
Property Value
- Rectangle
the size the barcode occupies.
Methods
CalculateEanParity(string)
Calculates the EAN parity character.
public static int CalculateEanParity(string code)
Parameters
code
stringthe code
Returns
- int
the parity character
ConvertUpcAtoUpce(string)
Converts an UPCA code into an UPCE code. If the code can not be converted a null is returned. code could not be converted
public static string ConvertUpcAtoUpce(string text)
Parameters
text
stringthe code to convert. It must have 12 numeric characters
Returns
- string
the 8 converted digits or null if the
CreateDrawingImage(Color, Color)
public override SKBitmap CreateDrawingImage(Color foreground, Color background)
Parameters
Returns
- SKBitmap
GetBarsEan13(string)
Creates the bars for the barcode EAN13 and UPCA.
public static byte[] GetBarsEan13(string barCode)
Parameters
barCode
stringthe text with 13 digits
Returns
- byte[]
the barcode
GetBarsEan8(string)
Creates the bars for the barcode EAN8.
public static byte[] GetBarsEan8(string barCode)
Parameters
barCode
stringthe text with 8 digits
Returns
- byte[]
the barcode
GetBarsSupplemental2(string)
Creates the bars for the barcode supplemental 2.
public static byte[] GetBarsSupplemental2(string barCode)
Parameters
barCode
stringthe text with 2 digits
Returns
- byte[]
the barcode
GetBarsSupplemental5(string)
Creates the bars for the barcode supplemental 5.
public static byte[] GetBarsSupplemental5(string barCode)
Parameters
barCode
stringthe text with 5 digits
Returns
- byte[]
the barcode
GetBarsUpce(string)
Creates the bars for the barcode UPCE.
public static byte[] GetBarsUpce(string barCode)
Parameters
barCode
stringthe text with 8 digits
Returns
- byte[]
the barcode
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 override 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