0

I am trying to Print an Image of Dimensions width=94px and height=109px to an ID-card using FARGO DTC-4500 Printer which prints at 300 DPI.

The image is stored in a database with 640*480px dimensions; now that's too big to print on an ID-card of size CR-80.

So I am fetching the image from database and resizing it using the following code.

MemoryStream photostream= new MemoryStream(photo);
System.Drawing.Image image = System.Drawing.Image.FromStream(photostream);
Bitmap bmp = new Bitmap(94,109);
bmp.SetResolution(300, 300);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmp);
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, 94, 109);
gr.DrawImage(image, rectDestination, 0, 0, image.Width, image.Height, GraphicsUnit.Inch);
bmp.Save(@"C:\Users\abdullah\Desktop\MOI_IDC\MOI_IDC\TempImages\" + ID + ".jpg",
        System.Drawing.Imaging.ImageFormat.Jpeg);
FileInfo photoFile = 
     new FileInfo(@"C:\Users\abdullah\Desktop\MOI_IDC\MOI_IDC\TempImages\" + ID + ".jpg");

Now this works fine and resizes image to 94*109px with 300 DPI but when i print this image its still big and i cant figure it out. how to get the image to print at 0.81 inch * 1.13 inch on the IDcard?

TaW
  • 53,122
  • 8
  • 69
  • 111
Abdullah Malikyar
  • 231
  • 1
  • 4
  • 19
  • Well, how do you print it?? The usualy way would be to do a size and or dpi adaption there.. – TaW Nov 09 '15 at 11:06
  • Well i am not doing anything there, since the FARGO SDK provides predefined methods that takes an image and its XY coordinates and prints it on the ID-card. but recently a friend suggested that i should use `PrintDocument` of .Net instead of SDK methods. can you please guide me to a sample of designing a Document using ` printDocument` which includes atleast one image and one text data. – Abdullah Malikyar Nov 09 '15 at 12:08
  • Ah. Well, do you have any images that print correctly? – TaW Nov 09 '15 at 12:12
  • No, all the images are zoomed in to an unexpected size. – Abdullah Malikyar Nov 09 '15 at 12:33
  • Hm, without seeing the SDK docs I can't really help. For pure .Net printing you may want to study for example [this post](http://stackoverflow.com/questions/28560319/generate-staff-card/28580657?s=18|0.0474#28580657) – TaW Nov 09 '15 at 12:55
  • Thank you for the link. and i don't think anyone can get much out of the SDK regarding this as there is no detials there. – Abdullah Malikyar Nov 10 '15 at 04:44

0 Answers0