This project is read-only.

Border around QRCode image when rendered to page

Sep 27, 2012 at 5:29 PM

Hi, 

I'm using QRCodeNet to display a simple QR code, which contains address info (vCard) onto

an ASP.Net page.  Problem is that the QR code has a border around the right and bottom which looks bad but also seems to stop the QR code being recognised  when scanned horizontally.  My code is shown below, any ideas? 

String vcs = vc.ToString();
                QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);
                QrCode qrCode = new QrCode();
                qrEncoder.TryEncode(vcs, out qrCode);            

                if (qrCode != null)
                {
                    Renderer renderer = new Renderer(3, Brushes.Black, Brushes.White);
                    MemoryStream ms = new MemoryStream();
                    renderer.WriteToStream(qrCode.Matrix, ms, ImageFormat.Png);
                    return Image.FromStream(ms);
                }              

Appreciate this may be more to do with my using of the Image object. 

Coordinator
Sep 29, 2012 at 7:55 AM

http://qrcodenet.codeplex.com/discussions/360974

Already solved. Please grab latest source code and use that version. 

There are documentations for latest source code. Which is here:

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

Oct 1, 2012 at 2:43 PM
silverlancer wrote:

http://qrcodenet.codeplex.com/discussions/360974

Already solved. Please grab latest source code and use that version. 

There are documentations for latest source code. Which is here:

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

Thanks, I will give that a try. 

Oct 4, 2012 at 3:18 PM
Edited Oct 4, 2012 at 3:18 PM
silverlancer wrote:

http://qrcodenet.codeplex.com/discussions/360974

Already solved. Please grab latest source code and use that version. 

There are documentations for latest source code. Which is here:

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

 

Hi, 

The new versiond of the dll (Gma.QrCodeNet.Encoding) is exactly the same as the one in my solution.

v4.0.30319

Have I got the correct version? 

 

Coordinator
Oct 4, 2012 at 6:44 PM

Where did you download newest version?

 

http://qrcodenet.codeplex.com/SourceControl/list/changesets

 

Latest version doesn't have any dll file include, you have to compile on your own. I don't remember I have set up version, the one you post is most likely C#'s version. Project version probably still at 1.0.0.0, as I have been lazy to modify that number. 

 

Oct 5, 2012 at 2:51 PM

Hi, 

I downloaded it from here, on the downloads tab.   

Do I just need to download the solution and compile if?  If so where do I get the solution 

as all the downloads I've seen are for a zip containing three dlls. 

Coordinator
Oct 6, 2012 at 4:49 AM

I have provide link on my last post. Under source control tab and select history. Grab newest version compile yourself with release version. You can also adjust compile setting on your own not big deal. Then you should have a proper dll under release folder. Google around for how to compile library you should easily find answer. 

Oct 19, 2012 at 4:18 PM

Hi There,

I found myself in the same situation as TheDaveGray. There is a border around every image. 

So I downloaded the latest version from here (download-button) and compiled it. But now I can't seem te call "Renderer" anymore. Do you know in which NameSpace it is used in? 

All the examples use a "Renderer".

If Renderer is not available anymore: do you have a sample code for writing a stream to file?

Thanks!

Coordinator
Oct 20, 2012 at 12:59 AM

 

http://qrcodenet.codeplex.com/discussions/360974

Already solved. Please grab latest source code and use that version. 

There are documentations for latest source code. Which is here:

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

 

^

My first post for this discussion. Hope it helps. 

Oct 23, 2012 at 3:28 PM

Thanks for your answer, but I can't still seem to write the stream to a file. This is what i've got so far:

 

'Building QRcode
Dim QRCodeEncoder As New QrEncoder(ErrorCorrectionLevel.H)
Dim QRCode As New QrCode
            
Dim QRrender As New Windows.Render.GraphicsRenderer(New Windows.Render.FixedModuleSize(4, Render.QuietZoneModules.Two), Brushes.Black, Brushes.White)
Dim QRStream As New MemoryStream()

QRCodeEncoder.TryEncode(QRCodeUrl, QRCode)

QRrender.WriteToStream(QRCode.Matrix, imageFormat:=System.Drawing.Imaging.ImageFormat.Png, stream:=QRStream)

'Previous version of QRcode generator (with border)
'Dim QRRender As New Renderer(10, Brushes.Black, Brushes.White)
'QRRender.CreateImageFile(QRCode.Matrix, "c:\temp\QRcode.bmp", imageFormat:=System.Drawing.Imaging.ImageFormat.Bmp)

 

But how do I write the stream to an image? In the previous version there was a function called CreateImageFile, to ehm..create an image file. Is there any substitute for this function? If not...can you show me how to do this (and tell me why the CreateImageFile had to leave the project?)

Thanks!

Coordinator
Oct 23, 2012 at 6:35 PM

Use filestream instead of memory stream. Example inside demo which come along with source code. 

Even though they are written in C#, but most likely similar to VB.