January 25, 2024 5:01 am

How to decode QR code

Recently i published a tutorial on How to Generate QR Code in PHP and many readers send emails to decode QR code, so I am writing this article to decode you QR code you have to upload image of QR code and it will show you text inside that code image. This QR code decoder works on HTML 5 file API and canvas tag and used webqr library.

how-to-decode-qr-code

[wpdm_file id=36]

Include js libraries in your page where you want to decode qr codes.

<script type="text/javascript" src="llqrcode.js"></script>
<script type="text/javascript" src="webqr.js"></script>

HTML for page design

<html>
<head>
<!--C S S  H E R E-->
</head>
<body onload="load(); setimg();">
<div id="main">
<div id="mainbody">
<div id="outdiv">
</div>
<div id="result"></div>
</div></div>           
<canvas id="qr-canvas" width="800" height="600"></canvas> <!--Canvas to draw image -->
</body>
</html>

CSS for styling

<style type="text/css">
body{
    width:100%;
    text-align:center;
}
#qrfile{
    width:320px;
    height:240px;
}
#qr-canvas{
    display:none;
}
#outdiv
{
    width:320px;
    height:240px;
    border: solid;
    border-width: 1px 1px 1px 1px;
}
#result{
    border: solid;
    border-width: 1px 1px 1px 1px;
    padding:20px;
    width:37.3%;
}
#imghelp{
    position:relative;
    left:0px;
    top:-160px;
    z-index:100;
    font:18px arial,sans-serif;
    background:#f0f0f0;
    margin-left:35px;
    margin-right:35px;
    padding-top:10px;
    padding-bottom:10px;
    border-radius:20px;
}
p.helptext{
    margin-top:54px;
    font:18px arial,sans-serif;
}
p.helptext2{
    margin-top:100px;
    font:18px arial,sans-serif;
}
</style>

Hope you like this tutorial feel free to comment.

Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.


Tutorial Categories:

18 responses to “How to decode QR code”

  1. capricorn says:

    Its awesome…..

  2. Husni's Elemento says:

    thanks dude…
    it will be in my next project

  3. om says:

    i m not allowed to download the files even after the subscription. its says you are not subscribed . i

  4. r4mirezz says:

    same problem as om i m not allowed to download the files even after the subscription. its says you are not subscribed .

  5. ernstzunehmend says:

    push: subscription – download – bug 😀

  6. Siavash says:

    fantabulous code!
    My question is how can I get the location, i.e. the xy
    coordinates, of the QR section in an image. To be more precise, suppose there is
    an A4 size image with a QR-code(4cm*4cm) on top left of it. What I need is the
    exact coordinates (in pixel) of the QR-code in that image.

  7. Madhav says:

    After subscription also , I am not able to download script….. 🙁

  8. Andreas Santo says:

    Cool tutorial 🙂

  9. Andreas Santo says:

    After subscription also , I am not able to download script….. 🙁

  10. sdfsdfsdf says:

    i m not allowed to download the files even after the subscription. its says you are not subscribed . i

  11. Ramone says:

    Hi, is it possible to supply the image as string to a PHP based api that would then decode it?

  12. Chiranjeevi Adi says:

    after getting the scanned text from image. whether you are storing the text somewhere if yes then tell me how you did?

  13. john fritz says:

    what to do if i need to select pdf file.??
    Can you suggest any changes..?

  14. Akhyar says:

    So many error in your web bro.. you must fix it or your web can be hacked.. ^-^

  15. NL Narasimhan says:

    Hi, QR code decoder is fantastic. I want to store the QR code output to a variable. I could not find it. Please help

  16. kyrolos hany says:

    Good

  17. sohail says:

    after decoding the qrcode I want to edit those text How to do it ?

Leave a Reply

Your email address will not be published. Required fields are marked *