GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / DrawBarcodeDataMatrix Method / DrawBarcodeDataMatrix(String,BarcodeDataMatrixEncodingMode,BarcodeDataMatrixVersion,Int32,Int32,Single,Single,Byte,Byte,Byte,Byte,Byte,Byte,Byte,Byte) Method
The data to encode using the required barcode symbol.
A member of the BarcodeDataMatrixEncodingMode enumeration. The DataMatrix barcode high level encoding mode.
A member of the BarcodeDataMatrixVersion enumeration. The version of the DataMatrix barcode.

You can use the BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto to let the engine decide the minimum version required to encode all specified data.

The number of modules composing the quiet zone.

A quiet zone is the margin area around the DataMatrix barcode, that does not contain any information. It separates the symbol from its surroundings and it should be at least one module wide. Using width of two module sizes is a good practice.

The size of each module within the drawn symbol, in points.

The module is the smallest cell in the DataMatrix barcode. The module size has to be made out of at least 2×2 printed dots for bigger reliability, therefore the recommended value for this parameter is 4 and greater.

The horizontal (X) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The vertical (Y) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The amount of cyan color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
The amount of magenta color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
The amount of yellow color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
The amount of black color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
The amount of cyan color to be used for the symbol's resulting background color. Use the value between 0 and 255.
The amount of magenta color to be used for symbol's resulting background color. Use the value between 0 and 255.
The amount of yellow color to be used for symbol's resulting background color. Use the value between 0 and 255.
The amount of black color to be used for symbol's resulting background color. Use the value between 0 and 255.
Example





In This Topic
DrawBarcodeDataMatrix(String,BarcodeDataMatrixEncodingMode,BarcodeDataMatrixVersion,Int32,Int32,Single,Single,Byte,Byte,Byte,Byte,Byte,Byte,Byte,Byte) Method
In This Topic
Draws a required DataMatrix barcode onto the currently selected page of the loaded PDF document according to your preference.

This method uses the CMYK color space for defining the desired colors (both fill and background) of the barcode symbol.

The coordinates and the dimensions of the DataMatrix barcode symbol need to be set in the current units with respect to the currently located origin defined in the PDF document, related to the actual page, where the symbol is to be drawn. You can use the GetMeasurementUnit method to determine the currently defined units and you can use the SetMeasurementUnit method to reset the units according to your preference.

Syntax
'Declaration
 
Public Overloads Function DrawBarcodeDataMatrix( _
   ByVal Data As String, _
   ByVal EncodingMode As BarcodeDataMatrixEncodingMode, _
   ByVal Version As BarcodeDataMatrixVersion, _
   ByVal QuietZone As Integer, _
   ByVal ModuleSize As Integer, _
   ByVal DstX As Single, _
   ByVal DstY As Single, _
   ByVal FillColorC As Byte, _
   ByVal FillColorM As Byte, _
   ByVal FillColorY As Byte, _
   ByVal FillColorK As Byte, _
   ByVal BackColorC As Byte, _
   ByVal BackColorM As Byte, _
   ByVal BackColorY As Byte, _
   ByVal BackColorK As Byte _
) As GdPictureStatus
public GdPictureStatus DrawBarcodeDataMatrix( 
   string Data,
   BarcodeDataMatrixEncodingMode EncodingMode,
   BarcodeDataMatrixVersion Version,
   int QuietZone,
   int ModuleSize,
   float DstX,
   float DstY,
   byte FillColorC,
   byte FillColorM,
   byte FillColorY,
   byte FillColorK,
   byte BackColorC,
   byte BackColorM,
   byte BackColorY,
   byte BackColorK
)
public function DrawBarcodeDataMatrix( 
    Data: String;
    EncodingMode: BarcodeDataMatrixEncodingMode;
    Version: BarcodeDataMatrixVersion;
    QuietZone: Integer;
    ModuleSize: Integer;
    DstX: Single;
    DstY: Single;
    FillColorC: Byte;
    FillColorM: Byte;
    FillColorY: Byte;
    FillColorK: Byte;
    BackColorC: Byte;
    BackColorM: Byte;
    BackColorY: Byte;
    BackColorK: Byte
): GdPictureStatus; 
public function DrawBarcodeDataMatrix( 
   Data : String,
   EncodingMode : BarcodeDataMatrixEncodingMode,
   Version : BarcodeDataMatrixVersion,
   QuietZone : int,
   ModuleSize : int,
   DstX : float,
   DstY : float,
   FillColorC : byte,
   FillColorM : byte,
   FillColorY : byte,
   FillColorK : byte,
   BackColorC : byte,
   BackColorM : byte,
   BackColorY : byte,
   BackColorK : byte
) : GdPictureStatus;
public: GdPictureStatus DrawBarcodeDataMatrix( 
   string* Data,
   BarcodeDataMatrixEncodingMode EncodingMode,
   BarcodeDataMatrixVersion Version,
   int QuietZone,
   int ModuleSize,
   float DstX,
   float DstY,
   byte FillColorC,
   byte FillColorM,
   byte FillColorY,
   byte FillColorK,
   byte BackColorC,
   byte BackColorM,
   byte BackColorY,
   byte BackColorK
) 
public:
GdPictureStatus DrawBarcodeDataMatrix( 
   String^ Data,
   BarcodeDataMatrixEncodingMode EncodingMode,
   BarcodeDataMatrixVersion Version,
   int QuietZone,
   int ModuleSize,
   float DstX,
   float DstY,
   byte FillColorC,
   byte FillColorM,
   byte FillColorY,
   byte FillColorK,
   byte BackColorC,
   byte BackColorM,
   byte BackColorY,
   byte BackColorK
) 

Parameters

Data
The data to encode using the required barcode symbol.
EncodingMode
A member of the BarcodeDataMatrixEncodingMode enumeration. The DataMatrix barcode high level encoding mode.
Version
A member of the BarcodeDataMatrixVersion enumeration. The version of the DataMatrix barcode.

You can use the BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto to let the engine decide the minimum version required to encode all specified data.

QuietZone
The number of modules composing the quiet zone.

A quiet zone is the margin area around the DataMatrix barcode, that does not contain any information. It separates the symbol from its surroundings and it should be at least one module wide. Using width of two module sizes is a good practice.

ModuleSize
The size of each module within the drawn symbol, in points.

The module is the smallest cell in the DataMatrix barcode. The module size has to be made out of at least 2×2 printed dots for bigger reliability, therefore the recommended value for this parameter is 4 and greater.

DstX
The horizontal (X) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
DstY
The vertical (Y) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
FillColorC
The amount of cyan color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
FillColorM
The amount of magenta color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
FillColorY
The amount of yellow color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
FillColorK
The amount of black color to be used for the symbol's resulting fill color. Use the value between 0 and 255.
BackColorC
The amount of cyan color to be used for the symbol's resulting background color. Use the value between 0 and 255.
BackColorM
The amount of magenta color to be used for symbol's resulting background color. Use the value between 0 and 255.
BackColorY
The amount of yellow color to be used for symbol's resulting background color. Use the value between 0 and 255.
BackColorK
The amount of black color to be used for symbol's resulting background color. Use the value between 0 and 255.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.

Just to remind you that 1 point is equivalent to 1/72 of an inch.

Example
How to draw various DataMatrix barcodes onto the newly created page of the new PDF document.
Dim caption As String = "Example: DrawBarcodeDataMatrix"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
    status = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeLetter)
    If status = GdPictureStatus.OK Then
        If (gdpicturePDF.DrawBarcodeDataMatrix("0123456789", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersion012x012,
                                                4, 2, 2, 2, 0, 255, 0, 0, 255, 0, 0, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawBarcodeDataMatrix("0123456789", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersion012x012,
                                                4, 4, 6, 2, 0, 255, 0, 0, 255, 0, 0, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawBarcodeDataMatrix("0123456789", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersion012x012,
                                                6, 8, 12, 2, 0, 255, 0, 0, 255, 0, 0, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawBarcodeDataMatrix("9876543210", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto,
                                                4, 2, 2, 10, 0, 255, 0, 0, 0, 0, 255, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawBarcodeDataMatrix("9876543210", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto,
                                                4, 4, 6, 10, 0, 255, 0, 0, 0, 0, 255, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawBarcodeDataMatrix("9876543210", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto,
                                                6, 8, 12, 10, 0, 255, 0, 0, 0, 0, 255, 0) = GdPictureStatus.OK) Then
            status = gdpicturePDF.SaveToFile("test_DrawBarcodeDataMatrix.pdf")
            If status = GdPictureStatus.OK Then
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
            Else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The one of the DrawBarcodeDataMatrix() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: DrawBarcodeDataMatrix";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
    status = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeLetter);
    if (status == GdPictureStatus.OK)
    {
        if ((gdpicturePDF.DrawBarcodeDataMatrix("0123456789", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersion012x012,
                                                 4, 2, 2, 2, 0, 255, 0, 0, 255, 0, 0, 0) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawBarcodeDataMatrix("0123456789", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersion012x012,
                                                 4, 4, 6, 2, 0, 255, 0, 0, 255, 0, 0, 0) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawBarcodeDataMatrix("0123456789", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersion012x012,
                                                 6, 8, 12, 2, 0, 255, 0, 0, 255, 0, 0, 0) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawBarcodeDataMatrix("9876543210", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto,
                                                 4, 2, 2, 10, 0, 255, 0, 0, 0, 0, 255, 0) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawBarcodeDataMatrix("9876543210", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto,
                                                 4, 4, 6, 10, 0, 255, 0, 0, 0, 0, 255, 0) == GdPictureStatus.OK) &&
            (gdpicturePDF.DrawBarcodeDataMatrix("9876543210", BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeASCII, BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto,
                                                 6, 8, 12, 10, 0, 255, 0, 0, 0, 0, 255, 0) == GdPictureStatus.OK))
        {
            status = gdpicturePDF.SaveToFile("test_DrawBarcodeDataMatrix.pdf");
            if (status == GdPictureStatus.OK)
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
            else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("The one of the DrawBarcodeDataMatrix() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
    }
    else
        MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption);
}
else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();
See Also