Creating QRCode for 300 or 600dpi printing on labels

Jul 1, 2012 at 3:05 PM

Hi Guys, any ideas on what settings i should use for high resolution images for saving/printing onto avery labels?

Coordinator
Jul 2, 2012 at 8:05 AM

With latest revision from source code, you can use DrawingBrushRenderer to achieve that. I will see if I can bring that function to other renderer. WriteableBitmapRenderer might also include that ability too, you can check under documentation. 

http://qrcodenet.codeplex.com/wikipage?title=Renderer&referringTitle=Documentation

Jul 3, 2012 at 8:34 PM

Thanks but we are unable to use this inside an asp.net app to automatically create the QRcodes since System.Windows.Media is not available in an aspx project. Is it possible for you to modify it to use System.Drawing instead?

using System;
using System.IO;
using System.Windows;
//using System.Windows.Media;
//using System.Windows.Media.Imaging;

using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.Drawing.Text;
using System.Drawing.Design;

Coordinator
Jul 4, 2012 at 7:33 AM

I can, but probably have no time to update until this weekend. 

If you want fast solution check out following website. 

http://stackoverflow.com/questions/2682292/c-sharp-winforms-how-to-change-dpi-of-the-system-drawing-bitmap

Create a bitmap on your own, then use Graphics.FromImage(bitmap) method to get graphics. Use graphicsRenderer to draw QrCode on graphics object. then save bitmap. 

 

using (Bitmap bitmap = new Bitmap(size.CodeWidth, size.CodeWidth)) 

{            

bitmap.SetResolution(DPI, DPI); 

using (Graphics graphics = Graphics.FromImage(bitmap))               

{                   

GraphicsRenderer.Draw(graphics, QrMatrix);                   

bitmap.Save(stream, imageFormat);               

}

}

One thing keep in mind that GraphicsRenderer use default DPI 96, you might have to convert pixel size from specific DPI to 96's DPI and then pass it to Renderer. Try around and see what happens. Else you have to wait for my update this weekend. 

Coordinator
Jul 7, 2012 at 10:55 PM

Did update with latest source code. It looks like use SetResolution method won't affect output image as WPF's WriteableBitmap. Let me know if there are any issue with it.