Class PdfCode128Barcode
Inherited Members
Namespace: Syncfusion.Pdf.Barcode
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfCode128Barcode : PdfUnidimensionalBarcode
Remarks
Only the following symbols are allowed in a Code 128C barcode: 0 1 2 3 4 5 6 7 8 9 FNC1 (\xF0). Code 128 C encodes only numeric symbols at double density, each pair of digits is encoded using a single symbol.
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfCode128CBarcode.
PdfCode128CBarcode code128C = new PdfCode128CBarcode();
//Set the font to code128C.
code128C.Font = font;
//Set the barcode text.
code128C.Text = "Code128C";
//Draw a barcode in the new Page.
code128C.Draw(page, new PointF(25, 500));
//Save the document to disk.
document.Save("Code128C.pdf");
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create font and font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
'Creates a new PdfCode128CBarcode.
Dim code128C As PdfCode128CBarcode = New PdfCode128CBarcode()
'Set the font to code128C.
code128C.Font = font
'Set the barcode text.
code128C.Text = "Code128C"
'Draw a barcode in the new Page.
code128C.Draw(page, new PointF(25, 500))
'Save the document to disk.
document.Save("Code128C.pdf")
Constructors
PdfCode128Barcode()
Initializes a new instance of the PdfCode128Barcode class.
Declaration
public PdfCode128Barcode()
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfCode128CBarcode.
PdfCode128CBarcode code128C = new PdfCode128CBarcode();
//Set the font to code128C.
code128C.Font = font;
//Set the barcode text.
code128C.Text = "Code128C";
//Draw a barcode in the new Page.
code128C.Draw(page, new PointF(25, 500));
//Save the document to disk.
document.Save("Code128C.pdf");
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create font and font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
'Creates a new PdfCode128CBarcode.
Dim code128C As PdfCode128CBarcode = New PdfCode128CBarcode()
'Set the font to code128C.
code128C.Font = font
'Set the barcode text.
code128C.Text = "Code128C"
'Draw a barcode in the new Page.
code128C.Draw(page, new PointF(25, 500))
'Save the document to disk.
document.Save("Code128C.pdf")
PdfCode128Barcode(String)
Initializes a new instance of the PdfCode128Barcode class.
Declaration
public PdfCode128Barcode(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The Barcode text. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfCode128CBarcode.
PdfCode128CBarcode code128C = new PdfCode128CBarcode("Code128C");
//Set the font to code128C.
code128C.Font = font;
//Draw a barcode in the new Page.
code128C.Draw(page, new PointF(25, 500));
//Save the document to disk.
document.Save("Code128C.pdf");
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create font and font style.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
'Creates a new PdfCode128CBarcode.
Dim code128C As PdfCode128CBarcode = New PdfCode128CBarcode("Code128C")
'Set the font to code128C.
code128C.Font = font
'Draw a barcode in the new Page.
code128C.Draw(page, new PointF(25, 500))
'Save the document to disk.
document.Save("Code128C.pdf")
Methods
CalculateCheckDigit()
Calculates the check digit for this barcode specification.
Declaration
protected override char[] CalculateCheckDigit()
Returns
Type | Description |
---|---|
System.Char[] | The Check digits. |
Overrides
GetDataToEncode(String)
Gets the data to encode.
Declaration
protected string GetDataToEncode(string originalData)
Parameters
Type | Name | Description |
---|---|---|
System.String | originalData | The original data. |
Returns
Type | Description |
---|---|
System.String | Encoded string. |