menu

Document Processing

PdfUnidimensionalBarcode Class - C# PDF Library API Reference | Syncfusion

    Show / Hide Table of Contents

    PdfUnidimensionalBarcode Class

    Inheritance
    System.Object
    PdfBarcode
    PdfUnidimensionalBarcode
    PdfCodabarBarcode
    PdfCode11Barcode
    PdfCode128ABarcode
    PdfCode128Barcode
    PdfCode128BBarcode
    PdfCode128CBarcode
    PdfCode39Barcode
    PdfCode93Barcode
    PdfCodeUpcBarcode
    PdfEan13Barcode
    PdfEan8Barcode
    PdfGS1Code128Barcode
    Inherited Members
    PdfBarcode.BackColor
    PdfBarcode.BarColor
    PdfBarcode.barHeight
    PdfBarcode.BarHeight
    PdfBarcode.bounds
    PdfBarcode.Bounds
    PdfBarcode.Location
    PdfBarcode.NarrowBarWidth
    PdfBarcode.QuietZone
    PdfBarcode.size
    PdfBarcode.Size
    PdfBarcode.Text
    PdfBarcode.TextColor
    Namespace: Syncfusion.Pdf.Barcode
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public abstract class PdfUnidimensionalBarcode : PdfBarcode
    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();
    //Creates a new PdfCodabarBarcode.
    PdfCodabarBarcode codaBarcode = new PdfCodabarBarcode();
    //Sets the barcode text.
    codaBarcode.Text = "0123";
    //Draws a barcode on the new Page.
    codaBarcode.Draw(page, new PointF(25, 500));
    //Save document to disk.
    document.Save("output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As 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 PdfCodabarBarcode.
    Dim codaBarcode As New PdfCodabarBarcode()
    'Sets the barcode text.
    codaBarcode.Text = "0123"
    'Draws a barcode on the new Page.
    codaBarcode.Draw(page, New PointF(25, 500))
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Constructors

    PdfUnidimensionalBarcode()

    Initializes the new instance of PdfUnidimensionalBarcode

    Declaration
    public 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();
    //Creates a new PdfCodabarBarcode.
    PdfCodabarBarcode codaBarcode = new PdfCodabarBarcode();
    //Sets the barcode text.
    codaBarcode.Text = "0123";
    //Draws a barcode on the new Page.
    codaBarcode.Draw(page, new PointF(25, 500));
    //Save document to disk.
    document.Save("output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As 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 PdfCodabarBarcode.
    Dim codaBarcode As New PdfCodabarBarcode()
    'Sets the barcode text.
    codaBarcode.Text = "0123"
    'Draws a barcode on the new Page.
    codaBarcode.Draw(page, New PointF(25, 500))
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Fields

    check

    Automatically adds the check digit to the barcode when true.

    Declaration
    protected bool check
    Field Value
    Type
    System.Boolean

    Properties

    BarcodeToTextGapHeight

    Declaration
    public float BarcodeToTextGapHeight { get; set; }
    Property Value
    Type
    System.Single
    Remarks

    The Default value is 5.

    See Also
    TextLocation

    EnableCheckDigit

    Declaration
    public bool EnableCheckDigit { get; set; }
    Property Value
    Type
    System.Boolean
    Remarks

    The Default value is True.

    EncodeStartStopSymbols

    Declaration
    public bool EncodeStartStopSymbols { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if [encode start stop symbols]; otherwise, false.

    Font

    Declaration
    public PdfFont Font { get; set; }
    Property Value
    Type
    PdfFont
    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();
    //Creates a new PdfCode93Barcode
    PdfCode93Barcode code93 = new PdfCode93Barcode("CODE93");
    //Create font and font style.
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold) ;
    //Set the barcode font.
    code93.Font = font;
    //Draw a barcode in the new Page.
    code93.Draw(page, new PointF(25, 500));
    //Save the  document to disk.
    document.Save("Code93.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 PdfCode93Barcode.
    Dim code93 As PdfCode93Barcode = New PdfCode93Barcode("CODE93")
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
    'Set the barcode font.
    code93.Font = font
    'Draw a barcode in the new Page.
    code93.Draw(page, New PointF(25, 500))
    'Save the  document to disk.
    document.Save("code93.pdf")

    ShowCheckDigit

    Declaration
    public bool ShowCheckDigit { get; set; }
    Property Value
    Type
    System.Boolean
    Remarks

    The Default value is false.

    TextAlignment

    Declaration
    public PdfBarcodeTextAlignment TextAlignment { get; set; }
    Property Value
    Type
    PdfBarcodeTextAlignment
    Remarks

    Default value is Center.

    See Also
    TextLocation

    TextDisplayLocation

    Declaration
    public TextLocation TextDisplayLocation { get; set; }
    Property Value
    Type
    TextLocation
    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();
    PdfCode93Barcode code93 = new PdfCode93Barcode("CODE93");
    //Set the barcode text display location.
    code93.TextDisplayLocation = TextLocation.Bottom;
    //Draw a barcode in the new Page.
    code93.Draw(page, new PointF(25, 500));
    //Save the  document to disk.
    document.Save("Code93.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 PdfCode93Barcode.
    Dim code93 As PdfCode93Barcode = New PdfCode93Barcode("CODE93")
    'Set the barcode text display location.
    code93.TextDisplayLocation =  TextLocation.Bottom
    'Draw a barcode in the new Page.
    code93.Draw(page, New PointF(25, 500))
    'Save the  document to disk.
    document.Save("code93.pdf")

    Methods

    CalculateCheckDigit()

    Calculates the check digit based on the barcode specification.

    Declaration
    protected virtual char[] CalculateCheckDigit()
    Returns
    Type Description
    System.Char[]

    Char array containing Check digits

    Draw(PdfGraphics)

    Draws the barcode on the PdfGraphics at the specified location.

    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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    code11.Location = new PointF(100,100);
    //Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics);
    //Save the  document to disk.
    document.Save("Code11.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
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
    'Creates a new PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    code11.Location = New PointF(100,100);
    'Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics)
    'Save the  document to disk.
    document.Save("Code11.pdf")

    Draw(PdfGraphics, PointF)

    Draws the barcode on the PdfGraphics at the specified location.

    Declaration
    public 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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, new PointF(25, 500));
    //Save the  document to disk.
    document.Save("Code11.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
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
    'Creates a new PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, New PointF(25, 500))
    'Save the  document to disk.
    document.Save("Code11.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 graphics.

    System.Drawing.PointF location

    The barcode location.

    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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, new PointF(25, 500), new SizeF(200,200));
    //Save the  document to disk.
    document.Save("Code11.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
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
    'Creates a new PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, New PointF(25, 500), New SizeF(200, 200))
    'Save the  document to disk.
    document.Save("Code11.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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, new RectangleF(25, 500,100,100));
    //Save the  document to disk.
    document.Save("Code11.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
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
    'Creates a new PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, New RectangleF(25, 500,100,100))
    'Save the  document to disk.
    document.Save("Code11.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 bouding 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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, 25, 500, 200, 200);
    //Save the  document to disk.
    document.Save("Code11.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
    'Create font and font style.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12f, PdfFontStyle.Bold)
    'Creates a new PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new PdfGraphics.
    code11.Draw(graphics, 25, 500,200, 200)
    'Save the  document to disk.
    document.Save("Code11.pdf")

    Draw(PdfPageBase)

    Draws the barcode on the PdfPage at the specified location.

    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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    code11.Location = new PointF(100,100);
    //Draw a barcode in the new Page.
    code11.Draw(page);
    //Save the  document to disk.
    document.Save("Code11.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 PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    code11.Location = New PointF(100,100);
    'Draw a barcode in the new Page.
    code11.Draw(page)
    'Save the  document to disk.
    document.Save("Code11.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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new Page.
    code11.Draw(page, new PointF(25, 500));
    //Save the  document to disk.
    document.Save("Code11.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 PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new Page.
    code11.Draw(page, New PointF(25, 500))
    'Save the  document to disk.
    document.Save("Code11.pdf")

    Draw(PdfPageBase, PointF, SizeF)

    Draw one dimensional barcode based on location and size value.

    Declaration
    public void Draw(PdfPageBase page, PointF location, SizeF size)
    Parameters
    Type Name Description
    PdfPageBase page

    The PDF page.

    System.Drawing.PointF location

    The barcode location.

    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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new Page.
    code11.Draw(page, new PointF(25, 500), new SizeF(200,200));
    //Save the  document to disk.
    document.Save("Code11.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 PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new Page.
    code11.Draw(page, New PointF(25, 500), New SizeF(200, 200))
    'Save the  document to disk.
    document.Save("Code11.pdf")

    Draw(PdfPageBase, RectangleF)

    Draw one dimensional barcode 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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new Page.
    code11.Draw(page, new RectangleF(new PointF(25, 500), new SizeF(200,200)));
    //Save the  document to disk.
    document.Save("Code11.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 PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new Page.
    code11.Draw(page, New RectangleF(New PointF(25, 500), New SizeF(200, 200)))
    'Save the  document to disk.
    document.Save("Code11.pdf")

    Draw(PdfPageBase, Single, Single, Single, Single)

    Draw one dimensional barcode 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 page.

    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 bouding 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 PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the font to code11.
    code11.Font = font;
    //Set the barcode text.
    code11.Text = "012345678";
    //Draw a barcode in the new Page.
    code11.Draw(page, 25, 500, 200, 200);
    //Save the  document to disk.
    document.Save("Code11.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 PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the font to code11.
    code11.Font = font
    'Set the barcode text.
    code11.Text = "012345678"
    'Draw a barcode in the new Page.
    code11.Draw(page, 25, 500,200, 200)
    'Save the  document to disk.
    document.Save("Code11.pdf")

    GetExtendedTextValue()

    To get the Extended Text

    Declaration
    protected virtual void GetExtendedTextValue()

    GetSizeValue()

    Returns the size of the barcode.

    Declaration
    protected override SizeF GetSizeValue()
    Returns
    Type Description
    System.Drawing.SizeF

    The Size.

    Overrides
    PdfBarcode.GetSizeValue()

    PaintRectangle(PdfGraphics, RectangleF)

    Declaration
    protected virtual float PaintRectangle(PdfGraphics graphics, RectangleF barRect)
    Parameters
    Type Name Description
    PdfGraphics graphics
    System.Drawing.RectangleF barRect
    Returns
    Type
    System.Single

    PaintRectangle(PdfPageBase, RectangleF)

    Internal method used to paint bars on the page.

    Declaration
    protected virtual float PaintRectangle(PdfPageBase page, RectangleF barRect)
    Parameters
    Type Name Description
    PdfPageBase page

    The Page.

    System.Drawing.RectangleF barRect

    The Rectangle.

    Returns
    Type Description
    System.Single

    Returns the right margin.

    PaintRectangleTag(PdfTemplate, RectangleF)

    Declaration
    protected virtual float PaintRectangleTag(PdfTemplate template, RectangleF barRect)
    Parameters
    Type Name Description
    PdfTemplate template
    System.Drawing.RectangleF barRect
    Returns
    Type
    System.Single

    ToImage()

    Generates an image for the barcode and returns it as a stream of data. A stream containing the generated barcode image.

    Declaration
    public virtual Image ToImage()
    Returns
    Type
    System.Drawing.Image
    Examples
    //Creates a new PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the barcode text.
    code11.Text = "012345678";
    //Get the image for Code32 Barcode.
    Image image= code32.ToImage();
    //Save the image into Disk
    image.Save("Code32.png", ImageFormat.Png);
    'Creates a new PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the barcode text.
    code11.Text = "012345678"
    'Get the image for Code32 Barcode.
    Image image= code32.ToImage()
    'Save the image into Disk
    image.Save("Code32.png", ImageFormat.Png)

    ToImage(SizeF)

    Generates an image for the barcode with the specified size and returns it as a stream of data.

    Declaration
    public Image ToImage(SizeF size)
    Parameters
    Type Name Description
    System.Drawing.SizeF size

    The size of the image to generate.

    Returns
    Type Description
    System.Drawing.Image

    A stream containing the generated barcode image.

    Examples
    //Creates a new PdfCode11Barcode.
    PdfCode11Barcode code11 = new PdfCode11Barcode();
    //Set the barcode text.
    code11.Text = "012345678";
    //Get the image for Code32 Barcode.
    Image image= code32.ToImage(new SizeF(200,200));
    //Save the image into Disk
    image.Save("Code32.png", ImageFormat.Png);
    'Creates a new PdfCode11Barcode.
    Dim code11 As PdfCode11Barcode = New PdfCode11Barcode()
    'Set the barcode text.
    code11.Text = "012345678"
    'Get the image for Code32 Barcode.
    Image image= code32.ToImage(New SizeF(200,200))
    'Save the image into Disk
    image.Save("Code32.png", ImageFormat.Png)

    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.

    Overrides
    PdfBarcode.Validate(String)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved