Class PdfCodeUpcBarcode
Inherited Members
Namespace: Syncfusion.Pdf.Barcode
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfCodeUpcBarcode : PdfUnidimensionalBarcode
Remarks
Only the following symbols are allowed in a UPC-A barcode: 0 1 2 3 4 5 6 7 8 9 B.
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 PdfCodeUpcBarcode.
PdfCodeUpcBarcode upcbarcode = new PdfCodeUpcBarcode();
//Set the font to upc.
upcbarcode.Font = font;
//Set the barcode text.
upcbarcode.Text = "UPC";
//Draw a barcode in the new Page.
upcbarcode.Draw(page, new PointF(25, 500));
//Save the document to disk.
document.Save("UPC.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 PdfCodeUpcBarcode.
Dim code32 As PdfCodeUpcBarcode = New PdfCodeUpcBarcode()
'Set the font to upc.
upcbarcode.Font = font;
'Set the barcode text.
upcbarcode.Text = "UPC"
'Draw a barcode in the new Page.
upcbarcode.Draw(page, new PointF(25, 500))
'Save the document to disk.
document.Save("UPC.pdf")
Constructors
PdfCodeUpcBarcode()
Initializes a new instance of the PdfCodeUpcBarcode class.
Declaration
public PdfCodeUpcBarcode()
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 PdfCodeUPCBarcode.
PdfCodeUpcBarcode upcbarcode = new PdfCodeUpcBarcode();
//Set the font to upc.
upcbarcode.Font = font;
//Set the barcode text.
upcbarcode.Text = "UPC";
//Draw a barcode in the new Page.
upcbarcode.Draw(page, new PointF(25, 500));
//Save the document to disk.
document.Save("UPC.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 PdfCodeUPCBarcode.
Dim code32 As PdfCodeUpcBarcode = New PdfCodeUpcBarcode()
'Set the font to upc.
upcbarcode.Font = font;
'Set the barcode text.
upcbarcode.Text = "UPC"
'Draw a barcode in the new Page.
upcbarcode.Draw(page, new PointF(25, 500))
'Save the document to disk.
document.Save("UPC.pdf")
PdfCodeUpcBarcode(String)
Initializes a new instance of the PdfCodeUpcBarcode class.
Declaration
public PdfCodeUpcBarcode(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 PdfCodeUPCBarcode.
PdfCodeUpcBarcode upcbarcode = new PdfCodeUpcBarcode("UPC");
//Set the font to upc.
upcbarcode.Font = font;
//Draw a barcode in the new Page.
upcbarcode.Draw(page, new PointF(25, 500));
//Save the document to disk.
document.Save("UPC.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 PdfCodeUPCBarcode.
Dim code32 As PdfCodeUpcBarcode = New PdfCodeUpcBarcode("UPC")
'Set the font to upc.
upcbarcode.Font = font;
'Draw a barcode in the new Page.
upcbarcode.Draw(page, new PointF(25, 500))
'Save the document to disk.
document.Save("UPC.pdf")
Methods
CalculateCheckDigit()
Calculates the check digit for this barcode specification.
Declaration
protected override char[] CalculateCheckDigit()
Returns
Type | Description |
---|---|
System.Char[] | The Check digits. |