Class PdfCode128CBarcode
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Syncfusion.Pdf.Barcode
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfCode128CBarcode : 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
PdfCode128CBarcode()
Initializes a new instance of the PdfCode128CBarcode class.
Declaration
public PdfCode128CBarcode()
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")
PdfCode128CBarcode(String)
Initializes a new instance of the PdfCode128CBarcode class.
Declaration
public PdfCode128CBarcode(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. |
Validate(String)
Internal method used to validate the given barcode text.
Declaration
protected override bool Validate(string data)
Parameters
Type | Name | Description |
---|---|---|
System.String | data | The Text. |
Returns
Type | Description |
---|---|
System.Boolean | True if valid, Otherwise False. |