menu

Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfDataMatrixBarcode - Xamarin.Android API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfDataMatrixBarcode

    Represents the PDF datamatrix barcode.

    Inheritance
    System.Object
    PdfBidimensionalBarcode
    PdfDataMatrixBarcode
    Inherited Members
    PdfBidimensionalBarcode.BackColor
    PdfBidimensionalBarcode.ForeColor
    PdfBidimensionalBarcode.Location
    PdfBidimensionalBarcode.QuietZone
    PdfBidimensionalBarcode.Text
    PdfBidimensionalBarcode.XDimension
    Namespace: Syncfusion.Pdf.Barcode
    Assembly: Syncfusion.Pdf.Portable.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
    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
    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(PdfGraphics)

    Draws the barcode on the PdfGraphics.

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

    The PDF graphics.

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

    Draw(PdfGraphics, PointF)

    Draws the barcode on the PdfGraphics at the specified location.

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

    The PDF graphics.

    PointF location

    Location to draw barcode.

    Overrides
    PdfBidimensionalBarcode.Draw(PdfGraphics, 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();
    //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 dimension 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 dimension 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)

    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
    PointF location
    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();
    //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 dimension of the barcode.
    datamatrix.XDimension = 5;        
    //Draws a barcode on the new PdfGraphics.
    datamatrix.Draw(graphics, 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()
     'Create Pdf graphics for the page.
     Dim graphics As PdfGraphics graphics=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 dimension of the barcode.
    datamatrix.XDimension = 5       
    'Draws a barcode on the new PdfGraphics.
    datamatrix.Draw(graphics, New PointF(100,100), New SizeF(200,200))
    'Save document to disk.
    document.Save("output.pdf")
    'Close the document.
    document.Close(True)

    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 page to be drawn the barcode.

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

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

    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
    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
    PointF location
    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.

    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
    System.Single height
    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)

    Extension Methods

    PdfBarcodeExtension.ToImage(PdfBidimensionalBarcode)
    PdfBarcodeExtension.ToImage(PdfBidimensionalBarcode, SizeF)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved