Javascript 用于生成二维码的javascript API
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7196798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
javascript API for generating QR codes
提问by lmkk
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.
我正在寻找用于生成 QR 码(名称、地址等)并以可打印格式(png/jpeg/pdf)输出它们的 javascript API。在我看来,这是其他人以前必须需要的东西。
采纳答案by ceejayoz
Google has a QR code generator as part of their Chart Tools that you can use here.
Google 有一个 QR 码生成器,作为其图表工具的一部分,您可以在此处使用。
http://code.google.com/apis/chart/infographics/docs/qr_codes.html
http://code.google.com/apis/chart/infographics/docs/qr_codes.html
回答by Maksym Kozlenko
jquery-qrcode jQuery plugin also generates QR code using HTML5 canvas element or HTML table, if canvas is not supported.
如果不支持画布,jquery-qrcode jQuery 插件也会使用 HTML5 画布元素或 HTML 表格生成二维码。
https://github.com/jeromeetienne/jquery-qrcode
https://github.com/jeromeetienne/jquery-qrcode
$('#test').qrcode({
width: 120,
height: 120,
text: "https://github.com/jeromeetienne/jquery-qrcode"});
Working jsFiddle demo:
工作jsFiddle演示:
回答by YCode
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
Maksym 的解决方案比 Google 的库更好,因为它在本地运行不需要调用 Google API。另外如果你不使用 jQuery,你可以在https://github.com/amanuel/JS-HTML5-QRCode-Generator使用这个
回答by raghavsood33
Another HTML5 solution is http://davidshimjs.github.io/qrcodejs/with IE6~10, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile
browser compatibility
另一个 HTML5 解决方案是http://davidshimjs.github.io/qrcodejs/,具有IE6~10, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile
浏览器兼容性
回答by Arif
You can use Telerik Kendo-UI to generate qrcode and barcode. It is easy to use.
您可以使用 Telerik Kendo-UI 生成qrcode 和条形码。这个用起来很简单。
Try using this example code:
尝试使用此示例代码:
QR Code: https://demos.telerik.com/kendo-ui/qrcode/index
二维码:https: //demos.telerik.com/kendo-ui/qrcode/index
回答by Subodh kumar
https://drive.google.com/open?id=0B3TWIbBcUUTwcE1vV24wQnRxNGs
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...
上面是 js 文件的链接,将它包含在您的项目中,并在 cake php 或任何您想使用的任何地方的 ctp 文件中编写以下代码。我在蛋糕 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>