C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
A simle way to generate Datamatrix barcode using C# Posted by aipsys on 23 Dec 2012 at 8:12 PM

constants:
SymbolSize:

SymbolRectAuto = -2
SymbolSquareAuto=-1
Symbol10x10=0
Symbol12x12=1
Symbol14x14=2
Symbol16x16=3
Symbol18x18=4
Symbol20x20=5
Symbol22x22=6
Symbol24x24=7
Symbol26x26=8
Symbol32x32=9
Symbol36x36=10
Symbol40x40=11
Symbol44x44=12
Symbol48x48=13
Symbol52x52=14
Symbol64x64=15
Symbol72x72=16
Symbol80x80=17
Symbol88x88=18
Symbol96x96=19
Symbol104x104=20
Symbol120x120=21
Symbol132x132=22
Symbol144x144=23
Symbol8x18=24
Symbol8x32=25
Symbol12x26=26
Symbol12x36=27
Symbol16x36=28
Symbol16x48=29


Mode:

Ascii=0
C40=1
Text=2
X12=3
Edifact=4
Base256=5
AsciiGS1=6


Programming samples:

.........
using aipsys.datamatrix.encoder;
..........

Encode to Bitmap and show it:

ImageEncoder iee = new ImageEncoder();
ie.Margin = 4;
ie.PixelSize = 3;
ie.Scheme = 0;
ie.SymbolSize = -2;
string s = "http://www.aipsys.com";
pictureBox1.Image = iee.Encode2Image(s);

Encode and save the barcode image to file:

ImageEncoder ie = new ImageEncoder();
ie.Margin = 4;
ie.PixelSize = 3;
ie.Scheme = 0;
ie.SymbolSize = -2;
ie.Encode2ImageFile("http://www.aipsys.com", "c:\\test.gif");


the SDK can be downloaded from http://www.aipsys.com
Report
Re: A simle way to generate Datamatrix barcode using C# Posted by Thomassunshine on 24 Jan 2013 at 11:46 PM
The symbol size of Data Matrix ECC200 consists of even rows and even columns. Some symbols are square with sizes from 10*10 to 144*144; some symbols are rectangular with sizes from 8*18 to 16*48
Here is a sample code of create Data Matrix in .net.
using BusinessRefinery.Barcode;

DataMatrix barcode = new DataMatrix();
barcode.Code = "Data Matrix";
barcode.Format = ImageFormat.Gif;
barcode.drawBarcode2ImageFile("c:/data-matrix-csharp.gif");
Report
Re: A simle way to generate Datamatrix barcode using C# Posted by abby321 on 10 Apr 2013 at 8:40 PM
I have ever used the following codes to generate DataMatrix barcode image sucessfully. It's also very simple.
BarcodeLib.Barcode.DataMatrix datamatrix = new BarcodeLib.Barcode.DataMatrix();
datamatrix.Data = "1dfefg%^7fdsg56566";

datamatrix.BackgroundColor = System.Drawing.Color.White;
datamatrix.ModuleSize =6;
datamatrix.RightMargin = 6;
datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;


// save barcode image into your system
datamatrix.drawBarcode("c:/datamatrix.jpeg");

// Encode datamatrix barcode & output to byte array
byte[] barcodeInBytes = datamatrix.drawBarcodeAsBytes();

// Encode datamatrix barcode to Graphics object
Graphics graphics = ...;
datamatrix.drawBarcode(graphics);

// Encode datamatrix barcode and output to HttpResponse object
HttpResponse response = ...;
datamatrix drawBarcode(response);

// Encode datamatrix barcode and output to Stream object
Stream stream = ...;
datamatrix drawBarcode(stream);
Report
Re: A simle way to generate Datamatrix barcode using C# Posted by abby321 on 10 Apr 2013 at 8:42 PM
I have ever used the following codes to generate DataMatrix barcode image sucessfully. It's also very simple.
BarcodeLib.Barcode.DataMatrix datamatrix = new BarcodeLib.Barcode.DataMatrix();
datamatrix.Data = "1dfefg%^7fdsg56566";

datamatrix.BackgroundColor = System.Drawing.Color.White;
datamatrix.ModuleSize =6;
datamatrix.RightMargin = 6;
datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;


// save barcode image into your system
datamatrix.drawBarcode("c:/datamatrix.jpeg");

// Encode datamatrix barcode & output to byte array
byte[] barcodeInBytes = datamatrix.drawBarcodeAsBytes();

// Encode datamatrix barcode to Graphics object
Graphics graphics = ...;
datamatrix.drawBarcode(graphics);

// Encode datamatrix barcode and output to HttpResponse object
HttpResponse response = ...;
datamatrix drawBarcode(response);

// Encode datamatrix barcode and output to Stream object
Stream stream = ...;
datamatrix drawBarcode(stream);
Report
Re: A simle way to generate Datamatrix barcode using C# Posted by SFSAFSS on 11 Apr 2013 at 8:19 PM
Here is the sample Code I have used to create Data Matrix barcode in C#:
using System;
using System.Collections.Generic;
using System.Text;
using OnBarcode.Barcode;
using System.Drawing.Imaging;
using System.Drawing;


DataMatrix datamatrix = new DataMatrix();

// Barcode data to encode
datamatrix.Data = "OnBarcode";
// Data Matrix data mode
datamatrix.DataMode = DataMatrixDataMode.ASCII;
// Data Matrix format mode
datamatrix.FormatMode = DataMatrixFormatMode.Format_16X16;

/*
* Barcode Image Related Settings
*/
// Unit of meature for all size related setting in the library.
datamatrix.UOM = UnitOfMeasure.PIXEL;
// Bar module size (X), default is 3 pixel;
datamatrix.X = 3;
// Barcode image left, right, top, bottom margins. Defaults are 0.
datamatrix.LeftMargin = 0;
datamatrix.RightMargin = 0;
datamatrix.TopMargin = 0;
datamatrix.BottomMargin = 0;
// Image resolution in dpi, default is 72 dpi.
datamatrix.Resolution = 72;
// Created barcode orientation.
//4 options are: facing left, facing right, facing bottom, and facing top
datamatrix.Rotate = Rotate.Rotate0;

// Generate data matrix and encode barcode to gif format
datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;
datamatrix.drawBarcode("C:\\datamatrix.gif");

/*
You can also call other drawing methods to generate barcodes

public void drawBarcode(Graphics graphics);

public void drawBarcode(string filename);

public Bitmap drawBarcode();

public void drawBarcode(Stream stream);

*/
The C# barcode data encoding guide is very helpful.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.