menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfBidimensionalBarcode - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfBidimensionalBarcode

    Inheritance
    System.Object
    PdfBidimensionalBarcode
    Pdf417Barcode
    PdfDataMatrixBarcode
    PdfQRBarcode
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Pdf.Barcode
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public abstract class PdfBidimensionalBarcode
    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 PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";   
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new Page.
    datamatrix.Draw(page);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"  
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new Page.
    datamatrix.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Constructors

    PdfBidimensionalBarcode()

    Declaration
    public PdfBidimensionalBarcode()
    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 PDF QR barcode.
    PdfQRBarcode qrBarcode = new PdfQRBarcode();
    //Set text.
    qrBarcode.Text = "www.syncfusion.com";
    //Set barcode size.
    qrBarcode.Size = new SizeF(200, 200);
    //Set the dimention of the barcode.
    qrBarcode.XDimension = 5;
    //Set the barcode location.
    qrBarcode.Location = new PointF(100, 100);
    //Draw the barcode to PDF page.
    qrBarcode.Draw(page);
    //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 PDF QR barcode.
    Dim qrBarcode As New PdfQRBarcode()
    'Set text.
    qrBarcode.Text = "www.syncfusion.com"
    'Set barcode size.
    qrBarcode.Size = New SizeF(200, 200)
    'Set the dimention of the barcode.
    qrBarcode.XDimension = 5
    'Set the barcode location.
    qrBarcode.Location = New PointF(100, 100)
    'Draw the barcode to PDF page.
    qrBarcode.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Properties

    BackColor

    Declaration
    public PdfColor BackColor { get; set; }
    Property Value
    Type
    PdfColor
    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 PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new Page.
    datamatrix.Draw(page);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new Page.
    datamatrix.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    ForeColor

    Declaration
    public PdfColor ForeColor { get; set; }
    Property Value
    Type
    PdfColor
    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 PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set fore color.
    datamatrix.ForeColor = new PdfColor(Color.Red);
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Yellow);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new Page.
    datamatrix.Draw(page);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set fore color.
    datamatrix.ForeColor = New PdfColor(Color.Red)
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Yellow)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new Page.
    datamatrix.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Location

    Gets or set the location of the barcode to be rendered in the page.

    Declaration
    public PointF Location { get; set; }
    Property Value
    Type
    System.Drawing.PointF
    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 PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new Page.
    datamatrix.Draw(page);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new Page.
    datamatrix.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    QuietZone

    Gets or sets Quietzone for the barcode.

    Declaration
    public PdfBarcodeQuietZones QuietZone { get; set; }
    Property Value
    Type
    PdfBarcodeQuietZones

    Size

    Gets or set the size of the barcode.

    Declaration
    public virtual SizeF Size { get; set; }
    Property Value
    Type
    System.Drawing.SizeF
    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 PDF QR barcode.
    PdfQRBarcode qrBarcode = new PdfQRBarcode();
    //Set text.
    qrBarcode.Text = "012345678";
    //Set barcode size.
    qrBarcode.Size = new SizeF(200, 200);
    //Set the dimention of the barcode.
    qrBarcode.XDimension = 5;
    //Set the barcode location.
    qrBarcode.Location = new PointF(100, 100);
    //Draw the barcode to PDF page.
    qrBarcode.Draw(page);
    //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 PDF QR barcode.
    Dim qrBarcode As New PdfQRBarcode()
    'Set text.
    qrBarcode.Text = "012345678"
    'Set barcode size.
    qrBarcode.Size = New SizeF(200, 200)
    'Set the dimention of the barcode.
    qrBarcode.XDimension = 5
    'Set the barcode location.
    qrBarcode.Location = New PointF(100, 100)
    'Draw the barcode to PDF page.
    qrBarcode.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Text

    Declaration
    public string Text { get; set; }
    Property Value
    Type
    System.String
    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 PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new Page.
    datamatrix.Draw(page);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new Page.
    datamatrix.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    XDimension

    Declaration
    public float XDimension { get; set; }
    Property Value
    Type
    System.Single
    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 PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new Page.
    datamatrix.Draw(page);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new Page.
    datamatrix.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Methods

    Draw(PdfGraphics)

    Draws the barcode on the PdfGraphics.

    Declaration
    public abstract void Draw(PdfGraphics graphics)
    Parameters
    Type Name Description
    PdfGraphics graphics

    The PDF graphics to be drawn 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;
    //Creates a new PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new PdfGraphics.
    datamatrix.Draw(graphics);
    //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()
    'Create Pdf graphics for the page.
     Dim graphics As PdfGraphics=page.Graphics
    'Creates a new PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new PdfGraphics.
    datamatrix.Draw(graphics)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Draw(PdfGraphics, PointF)

    Draws the barcode on the PdfGraphics at the specified location.

    Declaration
    public abstract void Draw(PdfGraphics graphics, PointF location)
    Parameters
    Type Name Description
    PdfGraphics graphics

    The PdfGraphics to be drawn the barcode.

    System.Drawing.PointF location

    The location of the barcode to be drawn in the 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 Pdf graphics for the page.
    PdfGraphics graphics=page.Graphics;
    //Creates a new PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;        
    //Draws a barcode on the new PdfGraphics.
    datamatrix.Draw(graphics, new PointF(100,100));
    //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()
     'Create Pdf graphics for the page.
     Dim graphics As PdfGraphics=page.Graphics
    'Creates a new PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5       
    'Draws a barcode on the new PdfGraphics.
    datamatrix.Draw(pdfGraphics, New PointF(100,100))
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Draw(PdfPageBase)

    Draw the barcode to PDF page.

    Declaration
    public abstract void Draw(PdfPageBase page)
    Parameters
    Type Name Description
    PdfPageBase page

    The PDF page to be drawn 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();
    //Creates a new PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Draws a barcode on the new Page.
    datamatrix.Draw(page);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Draws a barcode on the new Page.
    datamatrix.Draw(page)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Draw(PdfPageBase, PointF)

    Draw the barcode to PDF.

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

    The PdfPageBase to be drawn the barcode.

    System.Drawing.PointF location

    The location of the barcode to be drawn in the 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();
    //Creates a new PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";
    //Set back color.
    datamatrix.BackColor = new PdfColor(Color.Red);
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;        
    //Draws a barcode on the new Page.
    datamatrix.Draw(page, new PointF(100,100));
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set back color.
    datamatrix.BackColor = New PdfColor(Color.Red)
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5       
    'Draws a barcode on the new Page.
    datamatrix.Draw(page, New PointF(100,100))
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    ToImage()

    Export the barcode as image.

    Declaration
    public abstract Image ToImage()
    Returns
    Type Description
    System.Drawing.Image

    The exported image 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();
    //Creates a new PDF datamatrix barcode.
    PdfDataMatrixBarcode datamatrix = new PdfDataMatrixBarcode();
    //Sets the barcode text.
    datamatrix.Text = "Test";            
    //Set the dimention of the barcode.
    datamatrix.XDimension = 5;
    //Set the barcode location.
    datamatrix.Location = new PointF(100, 100);
    //Get the barcode as image.
    Image img = datamatrix.ToImage();
    //Draw image to PDF page.
    page.Graphics.DrawImage(new PdfBitmap(img), PointF.Empty);
    //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 PDF datamatrix barcode.
    Dim datamatrix As New PdfDataMatrixBarcode()
    'Sets the barcode text.
    datamatrix.Text = "Test"
    'Set the dimention of the barcode.
    datamatrix.XDimension = 5
    'Set the barcode location.
    datamatrix.Location = New PointF(100, 100)
    'Get the barcode as image.
    Dim img As Image = datamatrix.ToImage()
    'Draw image to PDF page.
    page.Graphics.DrawImage(New PdfBitmap(img), PointF.Empty)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved