GdPicture.NET Reference Guide
BarcodeDataMatrixGetSize Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : BarcodeDataMatrixGetSize Method
The data of the barcode to encode.
A member of the BarcodeDataMatrixEncodingMode enumeration. The encoding mode.
A member of the BarcodeDataMatrixVersion enumeration. The version of the DataMatrix barcode. Use BarcodeDataMatrixVersionAuto to let the engine decide the minimum version required to encode all data.
The number of modules composing the quiet zone. The quiet zone defines the margin around the barcode. A value superior or equal to 4 is highly suggested.
The size of each module, in pixel. A value superior or equal to 4 is recommended.
Output parameter. The width, in pixel, required to render the DataMatrix barcode.
Output parameter. The height, in pixel, required to render the DataMatrix barcode.
Returns the size, in pixel, required to render a DataMatrix barcode on a Bitmap.
Syntax

Parameters

Data
The data of the barcode to encode.
EncodingMode
A member of the BarcodeDataMatrixEncodingMode enumeration. The encoding mode.
Version
A member of the BarcodeDataMatrixVersion enumeration. The version of the DataMatrix barcode. Use BarcodeDataMatrixVersionAuto to let the engine decide the minimum version required to encode all data.
QuietZone
The number of modules composing the quiet zone. The quiet zone defines the margin around the barcode. A value superior or equal to 4 is highly suggested.
ModuleSize
The size of each module, in pixel. A value superior or equal to 4 is recommended.
Width
Output parameter. The width, in pixel, required to render the DataMatrix barcode.
Height
Output parameter. The height, in pixel, required to render the DataMatrix barcode.

Return Value

A member of the GdPictureStatus enumeration.
Example
Drawing a DataMatrix barcode into a new GdPicture bitmap and save it as PNG image.
Const data As String = "abcdefghijklmnopqrstuvwxyz0123456789"
Const moduleSize As Integer = 4
Const quietZoneSize As Integer = 4
Const encodingMode As BarcodeDataMatrixEncodingMode = BarcodeDataMatrixEncodingMode.BarcodeDataMatrixEncodingModeUndefined
Dim oGdPictureImaging As New GdPictureImaging
Dim dmVersion As BarcodeDataMatrixVersion = BarcodeDataMatrixVersion.BarcodeDataMatrixVersionAuto
Dim width, height As Integer
If oGdPictureImaging.BarcodeDataMatrixGetSize(data, encodingMode, dmVersion, quietZoneSize, moduleSize, width, height) = GdPictureStatus.OK Then
   Dim ImageID As Integer = oGdPictureImaging.CreateNewGdPictureImage(width, height, Imaging.PixelFormat.Format24bppRgb, Color.Transparent)
   oGdPictureImaging.BarcodeDataMatrixWrite(ImageID, data, encodingMode, dmVersion, quietZoneSize, moduleSize, 0, 0, 0, Color.Red, Color.White)
   oGdPictureImaging.SaveAsPNG(ImageID, "datamatrix.png")
   oGdPictureImaging.ReleaseGdPictureImage(ImageID)
End If
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
BarcodeDataMatrixWrite(Int32,String,BarcodeDataMatrixEncodingMode,BarcodeDataMatrixVersion,Int32,Int32,Int32,Int32,Single,Color,Color) Method