How to Save label in the form of Image.

Mar 5, 2012 at 10:08 AM

Hi,

We are using Sharp Zebra code into our application to print label(with bar code).  But now it is directly printing the content using Zebra Printer(Printer Name GK420d).  But We would like to generate an image and need to save that image into local drive after/before printing Label.

Can you please let me know how to move forward to store label as image.

Thanks and Regards

Mastan

 

 

 

 

Aug 2, 2012 at 10:09 AM

Hello Mastan,

In case you are still using this library, you don't have to save the image to your hard disk to be able to print it. You can use the following commands:

imgToPrint.Save(@"C:\Sample.bmp");
imgToPrint.Dispose();

List<byte> res = new List<byte>();
res.AddRange(ZebraC.ZPLCommands.ClearPrinter(myPrinter.Settings));
res.AddRange(ZebraC.ZPLCommands.GraphicDelete('R', "SAMPLE"));
res.AddRange(ZebraC.ZPLCommands.ClearPrinter(myPrinter.Settings));
res.AddRange(ZebraC.ZPLCommands.GraphicStore(imgToPrint, 'R', "SAMPLE"));
res.AddRange(ZebraC.ZPLCommands.PrintBuffer(1));
myPrinter.Print(res.ToArray());

res = new List<byte>();
res.AddRange(ZebraC.ZPLCommands.ClearPrinter(myPrinter.Settings));
res.AddRange(ZebraC.ZPLCommands.GraphicWrite(15, 15, "SAMPLE", 'R'));
res.AddRange(ZebraC.ZPLCommands.PrintBuffer(1));
myPrinter.Print(res.ToArray());