WPF

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfDataMatrixBarcode - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfDataMatrixBarcode

    Represents the PDF datamatrix barcode.

    Inheritance
    System.Object
    PdfBidimensionalBarcode
    PdfDataMatrixBarcode
    Inherited Members
    PdfBidimensionalBarcode.Text
    PdfBidimensionalBarcode.BackColor
    PdfBidimensionalBarcode.QuietZone
    PdfBidimensionalBarcode.XDimension
    PdfBidimensionalBarcode.Location
    PdfBidimensionalBarcode.ForeColor
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Pdf.Barcode
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfDataMatrixBarcode : 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

    PdfDataMatrixBarcode()

    Initialize a new instance of the PdfDataMatrixBarcode class.

    Declaration
    public PdfDataMatrixBarcode()
    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)

    PdfDataMatrixBarcode(String)

    Initialize a new instance of the PdfDataMatrixBarcode class.

    Declaration
    public PdfDataMatrixBarcode(string text)
    Parameters
    Type Name Description
    System.String text

    Data to be converted as 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("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("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)

    Properties

    Encoding

    Declaration
    public PdfDataMatrixEncoding Encoding { get; set; }
    Property Value
    Type Description
    PdfDataMatrixEncoding
    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();
    //Set data matrix barcode encoding.
     datamatrix.Encoding = PdfDataMatrixEncoding.ASCII;    
    //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()
    'Set data matrix barcode encoding.
    datamatrix.Encoding = PdfDataMatrixEncoding.ASCII    
    '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)

    Size

    Declaration
    public PdfDataMatrixSize Size { get; set; }
    Property Value
    Type Description
    PdfDataMatrixSize
    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 barcode size.
    datamatrix.Size = PdfDataMatrixSize.Size20x20;
    //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 barcode size.
    datamatrix.Size = PdfDataMatrixSize.Size20x20
    '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(PdfPageBase)

    Draws datamatrix in the PdfPage.

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

    The PDF page.

    Overrides
    PdfBidimensionalBarcode.Draw(PdfPageBase)
    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)

    Draw(PdfPageBase, PointF)

    Declaration
    public override void Draw(PdfPageBase page, PointF location)
    Parameters
    Type Name Description
    PdfPageBase page
    System.Drawing.PointF location
    Overrides
    PdfBidimensionalBarcode.Draw(PdfPageBase, PointF)

    Draw(PdfPageBase, PointF, SizeF)

    Draw DataMatrix barcode on Pdf Document.

    Declaration
    public void Draw(PdfPageBase page, PointF location, SizeF Size)
    Parameters
    Type Name Description
    PdfPageBase page
    System.Drawing.PointF location
    System.Drawing.SizeF Size
    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), new SizeF(200,200));
    //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), New SizeF(200,200))
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    Draw(PdfPageBase, RectangleF)

    Draw DataMatrix Barcode in pdf document.

    Declaration
    public void Draw(PdfPageBase page, RectangleF Rectangle)
    Parameters
    Type Name Description
    PdfPageBase page

    The PDF page to be drawn the barcode.

    System.Drawing.RectangleF Rectangle

    The rectangle bounds of the rendering area.

    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 RectangleF(100, 100, 200, 200));
    //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 RectangleF(100, 100, 200, 200))
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

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

    Draw DataMatrix barcode in pdf document.

    Declaration
    public void Draw(PdfPageBase page, float x, float y, float Width, float Height)
    Parameters
    Type Name Description
    PdfPageBase page

    The PDF page to be draw the barcode.

    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 bounding rectangle.

    System.Single Width

    The width of the barcode bounding rectangle.

    System.Single Height

    The height of the barcode 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();
    //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, 100, 100, 200, 200);
    //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, 100, 100, 200, 200)
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    ToImage()

    Declaration
    public override Image ToImage()
    Returns
    Type Description
    System.Drawing.Image
    Overrides
    PdfBidimensionalBarcode.ToImage()
    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)

    ToImage(SizeF)

    Declaration
    public Image ToImage(SizeF size)
    Parameters
    Type Name Description
    System.Drawing.SizeF size
    Returns
    Type Description
    System.Drawing.Image
    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(new SizeF(200,200));
    //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(New SizeF(200,200))
    '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 - 2021 Syncfusion Inc. All Rights Reserved