Class PdfEan8Barcode
Represents the PdfEan8 barcode.
Inherited Members
Namespace: Syncfusion.Pdf.Barcode
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfEan8Barcode : PdfUnidimensionalBarcode
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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
barcode.Location = new PointF(100,100);
//Draw a barcode in the new Page.
barcode.Draw(page);
//Save the document to disk.
document.Save("Ean8Barcode.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()
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
barcode.Location = new PointF(100,100);
'Draw a barcode in the new Page.
barcode.Draw(page)
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Constructors
PdfEan8Barcode()
Initializes a new instance of the PdfEan8Barcode class.
Declaration
public PdfEan8Barcode()
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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the font to Ean8.
barcode.Font = font;
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new Page.
barcode.Draw(page, new PointF(25, 100));
//Save the document to disk.
document.Save("Ean8Barcode.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 PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the font to Ean8.
barcode.Font = font
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new Page.
barcode.Draw(page, new PointF(25, 100))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
PdfEan8Barcode(String)
Initializes a new instance of the PdfEan8Barcode class.
Declaration
public PdfEan8Barcode(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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode("1234567");
//Set the font to Ean8.
barcode.Font = font;
//Draw a barcode in the new Page.
barcode.Draw(page, new PointF(25, 100));
//Save the document to disk.
document.Save("Ean8Barcode.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 PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode("1234567")
'Set the font to Ean8.
barcode.Font = font
'Draw a barcode in the new Page.
barcode.Draw(page, new PointF(25, 100))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Methods
CheckNumericOnly(String)
Declaration
protected bool CheckNumericOnly(string data)
Parameters
Type | Name | Description |
---|---|---|
System.String | data |
Returns
Type | Description |
---|---|
System.Boolean |
Draw(PdfGraphics)
Draws the barcode on the PdfGraphics.
Declaration
public virtual void Draw(PdfGraphics graphics)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | The PDF graphics. |
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 Pdf graphics for the page.
PdfGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
barcode.Location = new PointF(100,100);
//Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics);
//Save the document to disk.
document.Save("Ean8Barcode.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 Pdf graphics for the page.
Dim graphics As PdfGraphics =page.Graphics
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
barcode.Location = new PointF(100,100);
'Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics)
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfGraphics, PointF)
Draws the barcode on the PdfGraphics at the specified location.
Declaration
public virtual void Draw(PdfGraphics graphics, PointF location)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | The pdf graphics. |
System.Drawing.PointF | location | The barcode location. |
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 Pdf graphics for the page.
PdfGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, new PointF(25, 100));
//Save the document to disk.
document.Save("Ean8Barcode.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 Pdf graphics for the page.
Dim graphics As PdfGraphics =page.Graphics;
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, New PointF(25, 100))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfGraphics, PointF, SizeF)
Draws the barcode on the PdfGraphics at the specified location and size.
Declaration
public void Draw(PdfGraphics graphics, PointF location, SizeF size)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | The PDF page. |
System.Drawing.PointF | location | The location of the barcode on the PDF graphics. |
System.Drawing.SizeF | size | The size of the barcode. |
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 Pdf graphics for the page.
PdfGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, new PointF(25, 100), new SizeF(200,200));
//Save the document to disk.
document.Save("Ean8Barcode.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 Pdf graphics for the page.
Dim graphics As PdfGraphics =page.Graphics
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, New PointF(25, 200), New SizeF(200, 200))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfGraphics, RectangleF)
Draws the barcode on the PdfGraphics at the specified rectangle.
Declaration
public void Draw(PdfGraphics graphics, RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | The PDF graphics. |
System.Drawing.RectangleF | rectangle | The bounds of the barcode. |
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 Pdf graphics for the page.
PdfGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, new RectangleF(25, 100, 200, 200));
//Save the document to disk.
document.Save("Ean8Barcode.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 Pdf graphics for the page.
DIm graphics As PdfGraphics =page.Graphics
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, New RectangleF(25, 100, 200, 200))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfGraphics, Single, Single, Single, Single)
Draws the barcode based on the provided float values.
Declaration
public void Draw(PdfGraphics graphics, float x, float y, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | The PDF graphics. |
System.Single | x | The x-coordinate of the upper-left corner of the bounding rectangle. |
System.Single | y | The y-coordinate of the upper-top corner of the bounding rectangle. |
System.Single | width | The width of the bounding rectangle. |
System.Single | height | The height of the bounding rectangle. |
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 Pdf graphics for the page.
PdfGraphics graphics=page.Graphics;
//Create font and font style.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
//Creates a new PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, 25, 100, 200, 200);
//Save the document to disk.
document.Save("Ean8Barcode.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 Pdf graphics for the page.
Dim graphics As PdfGraphics=page.Graphics
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new PdfGraphics.
barcode.Draw(graphics, 25, 100, 200, 200)
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfPageBase)
Draws the barcode on the PdfPage.
Declaration
public virtual void Draw(PdfPageBase page)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The PDF page. |
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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
barcode.Location = new PointF(100,100);
//Draw a barcode in the new Page.
barcode.Draw(page);
//Save the document to disk.
document.Save("Ean8Barcode.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()
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
barcode.Location = new PointF(100,100);
'Draw a barcode in the new Page.
barcode.Draw(page)
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfPageBase, PointF)
Draws the barcode on the PdfPage at the specified location.
Declaration
public virtual void Draw(PdfPageBase page, PointF location)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The pdf page. |
System.Drawing.PointF | location | The barcode location. |
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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new Page.
barcode.Draw(page, new PointF(25, 100));
//Save the document to disk.
document.Save("Ean8Barcode.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()
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new Page.
barcode.Draw(page, New PointF(25, 100))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfPageBase, PointF, SizeF)
Draw PdfEan8Barcode based on location and size values.
Declaration
public void Draw(PdfPageBase page, PointF location, SizeF size)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The PDF page. |
System.Drawing.PointF | location | The location of the barcode on the PDF page. |
System.Drawing.SizeF | size | The size of the barcode. |
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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new Page.
barcode.Draw(page, new PointF(25, 100), new SizeF(200,200));
//Save the document to disk.
document.Save("Ean8Barcode.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()
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new Page.
barcode.Draw(page, New PointF(25, 200), New SizeF(200, 200))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfPageBase, RectangleF)
Draw PdfEan8Barcode based on rectangle input values.
Declaration
public void Draw(PdfPageBase page, RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The PDF page. |
System.Drawing.RectangleF | rectangle | The bounds of the barcode. |
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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new Page.
barcode.Draw(page, new RectangleF(25, 100, 200, 200));
//Save the document to disk.
document.Save("Ean8Barcode.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()
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new Page.
barcode.Draw(page, New RectangleF(25, 100, 200, 200))
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
Draw(PdfPageBase, Single, Single, Single, Single)
Draw PdfEan8Barcode based on float input values.
Declaration
public void Draw(PdfPageBase page, float x, float y, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | The PDF graphics. |
System.Single | x | The x-coordinate of the upper-left corner of the bounding rectangle. |
System.Single | y | The y-coordinate of the upper-top corner of the bounding rectangle. |
System.Single | width | The width of the bounding rectangle. |
System.Single | height | The height of the bounding rectangle. |
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 PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Draw a barcode in the new Page.
barcode.Draw(page, 25, 100, 200, 200);
//Save the document to disk.
document.Save("Ean8Barcode.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()
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Draw a barcode in the new Page.
barcode.Draw(page, 25, 100, 200, 200)
'Save the document to disk.
document.Save("Ean8Barcode.pdf")
ToImage()
Exports the barcode as image.
Declaration
public override Image ToImage()
Returns
Type | Description |
---|---|
System.Drawing.Image |
Overrides
Examples
//Creates a new PdfEan8Barcode.
PdfEan8Barcode barcode = new PdfEan8Barcode();
//Set the barcode text.
barcode.Text = "1234567";
//Get the image for PdfEan8Barcode.
Image image= barcode.ToImage();
//Save the image into Disk
image.Save("PdfEan8.png", ImageFormat.Png);
'Creates a new PdfEan8Barcode.
Dim barcode As PdfEan8Barcode = New PdfEan8Barcode()
'Set the barcode text.
barcode.Text = "1234567"
'Get the image for PdfEan8Barcode.
Dim image As Image = barcode.ToImage()
'Save the image into Disk
image.Save("PdfEan8.png", ImageFormat.Png)
ToImage(SizeF)
Declaration
public Image ToImage(SizeF size)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | size |
Returns
Type | Description |
---|---|
System.Drawing.Image |