generating 200000 datamatrix 2d barcode take too much time how to less time

Total Post:17

Points:119
C#
 553  View(s)
Ratings:
Rate this:

I make windows form application c# vs 2015 to generate 2d matrix barcodes for pharmaceutical company manufacture medicine .
my problem when i make order to generate 2d matrix barcode for 200000 barcode and save barcodes in hard disk take 20 minutes
How to minimize 20 minutes to 8 minutes when generate and saving 200000 barcode ?
my code under button as following

I attached  libarary for datamatrix encoding with message

library data matrix

Class1 CLS = new Class1();
DataTable dt = CLS.ShowalldataSerial(textBox4.Text);
string baseText = "UserID" + dt.Rows[0][0] + "FirmName" + dt.Rows[0][1] + "OrderNo" + dt.Rows[0][2] + "BtachNo" + dt.Rows[0][3] + "Quantity" + dt.Rows[0][4] + "ProductName" + dt.Rows[0][5] + "SerialNo";
Color foregroundColor = Color.FromName(comboBox1.SelectedItem.ToString());
int serialsToGenerate = Convert.ToInt32(textBox1.Text);
Parallel.For(0, serialsToGenerate, index=>
{
string Serial = SRL.Rnd().ToString();
string txt = baseText + Serial;
// WARNING HERE
DM_Encoder dm = new DM_Encoder();
dm.DM(txt, foregroundColor, Color.White).Save(root + "\\" + Serial + ".emf", System.Drawing.Imaging.ImageFormat.Emf);
});

Answer