Dear sir,
I am printing mearged Image using zebra barcode printer in c#.
This is ok but when i am resezing this image and printing out from Zebra barcode printer in become blured.
Printing Image in not clear.
CODE
System.Drawing.Image img2 =
System.Drawing.Image.FromFile(Server.MapPath("~/QRCode/" + QRCodejJPG), true);
//This Information img2
System.Drawing.Image img1 =
System.Drawing.Image.FromFile(Server.MapPath("~/StringImage/" + StringJPG), true);
//WI-FI image img3
System.Drawing.Image img3 =
System.Drawing.Image.FromFile(Server.MapPath("~/QRCodeFormet/NEWImage.png"), true);
List<System.Drawing.Image> fileList = new List<System.Drawing.Image>();
fileList.Add(img1);
fileList.Add(img2);
fileList.Add(img3);
Bitmap bitmap2 = MergeImages(fileList);
bitmap2.Save(Server.MapPath("~/FinalQRCode/") + StringJPG, ImageFormat.Jpeg);
string QRfilename = Server.MapPath("~/FinalQRCode/" + StringJPG);
SendToPrinter(QRfilename);
merge three image,resize them and fixed the position of them
public static Bitmap MergeImages(List<System.Drawing.Image> images)
{
int StrWi = 95;
int Strh = 90;
int DEWi = 80;
int DEwh = 80;
int QRWi = 85;
int QRwh = 85;
int outputImageWidth = 0;
int outputImageHeight = 1;
foreach (System.Drawing.Image image in images)
{
outputImageHeight += image.Height;
if (image.Width > outputImageWidth)
{
outputImageWidth = image.Width;
}
}
Bitmap outputImage = new Bitmap(100, 200, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (Graphics graphics = Graphics.FromImage(outputImage))
{
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.Clear(Color.White);
graphics.DrawImage(images[0], new Rectangle(12,25,StrWi,Strh), new Rectangle(new Point(), images[0].Size), GraphicsUnit.Pixel);
graphics.DrawImage(images[1], new Rectangle(5, 98,QRWi,QRwh), new Rectangle(new Point(), images[1].Size), GraphicsUnit.Pixel);
graphics.DrawImage(images[2], new Rectangle(19, 95,DEWi,DEwh), new Rectangle(new Point(), images[2].Size), GraphicsUnit.Pixel);
}
return outputImage;
}
Printing Out Code
private void SendToPrinter(string ff)
{
Margins m = new Margins();
ProcessStartInfo info = new ProcessStartInfo();
info.Verb = "print";
info.FileName = ff;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(info);
Process p = new Process();
p.StartInfo = info;
p.Start();
//p.WaitForInputIdle();
//System.Threading.Thread.Sleep(3000);
//if (false == p.CloseMainWindow())
// p.Kill();
}