I am looking for a javascript API for generating QR codes (name, address and such) and outputting them in a printable format (png/jpeg/pdf). This seems to me to be something others before must have had a need for.
jquery-qrcode jQuery plugin also generates QR code using HTML5 canvas element or HTML table, if canvas is not supported.
https://github.com/jeromeetienne/jquery-qrcode
$('#test').qrcode({
width: 120,
height: 120,
text: "https://github.com/jeromeetienne/jquery-qrcode"});
Working jsFiddle demo:
Google has a QR code generator as part of their Chart Tools that you can use here.
http://code.google.com/apis/chart/infographics/docs/qr_codes.html
Maksym's solution is better than Google's library because it runs at local does not need to call Google API. also if you don't use jQuery, you can use this one at https://github.com/amanuel/JS-HTML5-QRCode-Generator
另一个HTML5解决方案是http://davidshimjs.github.io/qrcodejs/,具有IE6~10, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile
浏览器兼容性
You can use Telerik Kendo-UI to generate qrcode and barcode . It is easy to use.
Try using this example code:
https://drive.google.com/open?id=0B3TWIbBcUUTwcE1vV24wQnRxNGs
above is the link of js file include it in your project and write the below code in ctp file in cake php or any where you want to use. i tested it in cake php...
<-- including the file....
<?php echo $this->Html->script('jquery.qrcode.min.js')?>
<div style='padding:100px''><img id="demo" style='width: 100px,height: 100px'></div>
<script type="text/javascript">jQuery("#demo").qrcode({text: "HEllo World!"});</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.