Class PdfGS1Code128Barcode
Inherited Members
Namespace: Syncfusion.Pdf.Barcode
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfGS1Code128Barcode : 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
PdfGS1Code128Barcode()
Initializes a new instance of the PdfCode128CBarcode class.
Declaration
public PdfGS1Code128Barcode()
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")
PdfGS1Code128Barcode(String)
Initializes a new instance of the PdfCode128CBarcode class.
Declaration
public PdfGS1Code128Barcode(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. |