Home   iANPR   OMarks  Solutions   Online   Research   Company  

How to use the SDK for free generate DataMatrix?

We offer you a free SDK to encode DataMatrix! This is a library Dll, you can embed in any of your solutions operating systems Windows, and we do not charge for this money. Download DataMatrix Encode SDK.

Using is very simple. Copy library DataMatrixEncode.dll to directory with your program, and then it dynamically connect to your program. The catalog «sample» is an example of the language C/C + +. Originally connect the library:

HINSTANCE dllInstance=LoadLibrary("DataMatrixEncode.dll");

Once connected, you need to access the function code:

int (__stdcall *EncodeDataMatrix)(char* ,int, unsigned char* ,long *,int ,int ,int ,int );
(FARPROC&)EncodeDataMatrix = GetProcAddress(dllInstance,"EncodeDataMatrix");

The library has two functions encoding: EncodeDataMatrix (returns 24-bit image, EncodeDataMatrix1Bit (returns a monochrome image). Image format BMP. The syntax for functions:

int EncodeDataMatrix(
	char* EncodeText,
	int EncodeSize,
	unsigned char* out_bitmap,
	int *bufer_size,
	int SizeCell,
	int Code,
	int Mode,
	int SizeNum

EncodeText – 0 terminated string for encoding.
EncodeSize – should be 0, now not in use.
out_bitmap – buffer for the output image.
bufer_size – the buffer size.
SizeCell – cell size code.
Code – type of code (0).
Mode – coding (0-5), a description of the function modes can be viewed QueryMode.
SizeNum – size, 0-auto, or installed by the user (see modes as a function of QuerySize).
Return values:
0 – with the successful encoding;
1 – an incorrect code number;
1000 and higher values – the encoding error;
-1 – wrong size of the cell (less than 1);
3 - there is no place in the receiving buffer, in this case is written bufer_size required buffer size.

Example of use function:

long s=10000000;
BYTE* out_bitmap=new BYTE[s];
lstrcpy(buf,"Hello World!!! And 1234567890");
if (EncodeDataMatrix(buf,strlen(buf),out_bitmap,&s,4,0,5,0)!=0)
	printf("Encoding error!");
	delete out_bitmap;
	return 5;

Writing to a BMP file.

FILE *f;
if (f!=NULL)
else printf("Can not write bmp file!");
delete out_bitmap;

The result of coding:

You can check it using VidikonReader. If you notice any errors in the library, please contact us.

(C)2012-2017. IntBuSoft Ltd