This project is read-only.

How to implement the QRCode in My Website.

Dec 18, 2012 at 7:00 AM

Hi all,

My problem is how can i implement the QR CODE in my web project.

Currently i am developing a Member Related website where i want to generate a QR Code for each member with specific URL (www.mywebsite.com/MemberDetails.aspx?id=123456).

So the members can download the image and attached it to as per there requirement.

So please help me how can i generate the Code & save its image to the server after saving the member profile.

Please Help.

Coordinator
Dec 19, 2012 at 7:13 AM

I don't have enough information about what you really want to do. Generate QrCode and render it on image are all under documentation. Depends on which version you use. 

Version 0.3's documentation is just under documentation page. 

Newest source code's documentation's links are on top of documentation page. 

 

Which info do you want to put into Qrcode. Do you want to show image to user before save. Why do you want them to download and attach to their profile. Without proper information I can not give any advice. 

Dec 19, 2012 at 9:15 AM

 

Actually i am developing a asp.net website where i want to generate a new QrCode whenever a user register with the member details .

But i try you documentation , and unable to create and save the QRCode in my website.

So if you provide me the source code of 1) generate the QRCode and 2) Save it as a .png file that will be very helpful for me .

Please help 

Coordinator
Dec 19, 2012 at 9:29 AM

Please come down. Which version are you using. Could you provide the code you have written to use our library. 

I know you want to develop asp.net website, It can be tell from your aspx web url. The thing is, generate a QrCode and then send to client, or generate a QrCode save on server's directory, or save at somewhere else are totally different story. 

You don't have to tell me exactly about your project, but at least you need tell me following.

1. which version you are using. The one from download tab marked as 0.3 or the one from source code tab. 

2. Which documentation you have been using. Provide your library related code with version if possible. So I can check out where you went wrong.

3. Which info you want to store inside QrCode. vCard? Just give some example. Something like John A, address etc etc. 

4. Where you want to save file towards. 

 

As I said on my previous post. 0.3 and newest source code are bit of different. That's why I wrote two documentations. It's not that simple as generate QrCode, save as png. 

Dec 19, 2012 at 12:39 PM

 

Ok  silverlancer

1. The one from download tab marked as 0.3.

2. Actually  unable to write the code . I want to convert the url ="www.mywebsite.com/MemberDetails.aspx?id=123456" into QR Code. And Save the File into My "~/MYapps/" folder with Member1.png Image which is included in the library.



 

Coordinator
Dec 19, 2012 at 5:35 PM

 

QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);
            QrCode qrCode = new QrCode();
            qrEncoder.TryEncode(strInput, out qrCode);

            Renderer renderer = new Renderer(5, Brushes.Black, Brushes.White);
            renderer.CreateImageFile(qrCode.Matrix, @"c:\temp\HelloWorld.png", ImageFormat.Png);


Response to your given information. That's code from documentation. Input you might want to use: 
string strInput = "http://www.mywebsite.com/MemberDetails.aspx?id=123456"; Your mark up, decoder won't know it's url. 
Another mark up for url is described here. : http://www.nttdocomo.co.jp/english/service/developer/make/content/barcode/function/application/bookmark/
But that's mainly for book mark. 
Dec 26, 2012 at 5:41 AM
Edited Dec 26, 2012 at 5:42 AM

 

Thanks a lot for your help .

For visual Studio 2008 which version should i use?

I need one more thing can i add one text line "Scan to Mywebsite" below the QrCode Image, At the time of QR image creation.

Please help.

Coordinator
Dec 26, 2012 at 7:19 AM

It's not base on your visual studio version, but more towards .net version. Current project is set up on .Net 4.0, so with that project it should be able to support 4.0+. 

But people do ask for 3.5 support, and at end I end up coding according to 3.5.

Cut in short, for dll in download page, that one is compiled under .Net 4.0. If you want to use under 3.5, just download latest source code compile yourselves under 3.5. Then, to create QrCode should be according to new documentation not the one I post up there. 

You can also download QrCode.Net 3.0's revision, and compile under 3.5. Then above code will stay same. 

 

For creating text line below QrCode image, that's not something I will put into our project, and it also have so many different ways to solve it. One of easiest way will be use latest source code and use WriteableBitmapRenderer. 

First, decide what's module size you are going to use, then create a QrCode according to input. 

Once you got QrCode matrix back, get size of it.  (Size + (Quiet zone size * 2)) * module size / DPI. That's how wide that image will be. In inch. Create a writeablebitmap object according to that wide, and with longer height. Then use WriteableBitmapRenderer's method DrawDarkModule to daw QrCode at top left corner, and you can draw word under that. Or use Draw(WriteableBitmap wBitmap, BitMatrix matrix, int offsetX, int offsetY) method to draw whole QrCode at specific location. You just have to play around with those method. 

I have provide them all, and source code is there for you to check out too. This is out of basic functionality, I will not provide exactly walk through for it now. But above information is more than enough to lead you there and save a lot of time. 

Hope that helps.