QR Code Generator implementation in JavaScript, Java and more
All the implementations are based on JIS X 0510:1999.
The word "QR Code" is registered trademark of DENSO WAVE INCORPORATED
http://www.denso-wave.com/qrcode/faqpatent-e.html
QR Code Generator implementation in JavaScript, Java and more.
Home Page: https://kazuhikoarase.github.io/qrcode-generator/js/demo/
License: MIT License
QR Code Generator implementation in JavaScript, Java and more
All the implementations are based on JIS X 0510:1999.
The word "QR Code" is registered trademark of DENSO WAVE INCORPORATED
http://www.denso-wave.com/qrcode/faqpatent-e.html
When I call createASCII with a margin of 0 and when the size of the qr code is odd, the last line is cut of and replaced with a half border.
I think the condition to substring and concat the half border should be if (*size % 2) && r)
at
Line 619 in a4ce043
example data =
http://localhost:8888/test/dddddd/1413363078552&sldkjfowierowierwoerowejrwoe.png
Could not generate code?
Alpha Numeric with more than 271 characters fails.
hello,
is there a way to add a quiet zone on the generated qr-code?
i'm using the javascript version and when i donwload the image some scanners can't read due some black backgrounds. on my page it works perfectly, but once i download it the issue emerges.
Hi, In TypeScript file, i use import('qrcode-generator') but there is an error of 'can't find the moudle' while i change 'import' into 'require' and it works. But since we start to use TypeScript2.0, we will not use require.
I think it may because there doesn't refer to the .d.ts file in the package.json.
Please resolve it.
Thank you!
In the sample_image.php
demo I can see how to create an image - but how do I change the size of that created image?
I have been playing with the code - cheers!
But while various specs say a QRCode can contain thousands of characters (and other apps encode long messages that are successfully decoded). This code seems limited to a couple of hundred chars...
Hi,
I am using this qr-code generator for my angular application. I am bit confused if this library provides a way to update the generated qr code based on the user given URL from the text box. I did that with updating of model property but nothing works. Any idea? please help.
NVM, my fault.
I just wanted to say thank you very much for this very nice library!
Now it would be even more nice to read some documentation... just a few basic things that are not immediately clear by the demos. Thanks!
qrcode-generator/php/qrcode.php
Line 1572 in 3c72b1b
Do you think this i
should be $i
?
Currently, the main API is createImgTag()
generating a complete img
element, containing the image data in the src
attribute as base64 encoded string. Setting other attributes (like id
, class
or style
) or applying an style to that element is a bit cumbersome (not impossible, but additional work), because the HTML element isn't there before the call.
Other QR code libraries often have an additional method which generates just the data string (which createImgTag()
creates as well, by the way), which then can be set / applied to an existing img
element with other attributes remaining present.
So, suggestion is to refactor some of the logic of createImgTag()
into createDataURL()
which latter method can also be called separately. Idea:
qr.createImgTag()
// => <img src="data:image/gif;base64,R0lGODdhcgFyAY..." width="370" height="370">
qr.createDataURL()
// => data:image/gif;base64,R0lGODdhcgFyAY...
Current code does not generate error free QR codes. Fortunately the errors are fixed by ReedSolomon, resulting in a still working QR code. The error is traced back to the following line, in the 'mapdata' function:
if (col == 6) col--;
This code is needed to skip the timing pattern column (col 6). But all columns <= 6 need to shift when filling the map data. Replacing the line with the following results in error free QR codes:
if (col <= 6) col--;
Thanks.
It seems you have many programming languages supported, that is great !
BUT, it makes it difficult for people to help/clone a specific language version, because they can only clone the whole with ALL of them.
So i suggest kindly to split your repo into branches per language.
For example a seperate repo-branch for js, another for php etc etc instead of one main branch... 👍
Hi,
I'm really happy with this library so far, thanks :)
I was wondering, would it be difficult to increase the type number up to 40?
I'm not entirely sure what needs to be done, perhaps if you can point me in the correct direction I can attempt to push up the limit. As I understand it 40 is the maximum type for QR codes, I'm personally in need of type 25+
Let me know if I am asking too much, I can always try to do this myself.
Regards,
Joe.
Plz support micro qr code(M1~M4)
is it possible to output the qr code as an svg file?
when I include the chinese in the qrcode,it's turn to be a massy code
I see that to create the image size moduleCount is used - what is that exactly?
Yes, some docs would be nice... or at least some code comments.
Why no docs / comments?
According to the typings from qrcode.d.ts, I should be able to do the following since the export is an instance of the QRCodeFactory
interface which has the call signature (typeNumber: TypeNumber, errorCorrectionLevel: ErrorCorrectionLevel) : QRCode;
:
import * as qrGenerator from 'qrcode-generator';
function myFunc() {
const qr = qrGenerator(0, 'H');
qr.addData('Hello, world!');
qr.make();
}
However, the typescript compiler returns:
Error: Cannot call a namespace ('qrGenerator')
Alternatively, using qrcode
like this compiles without a hitch:
import * as qrGenerator from 'qrcode-generator';
function myFunc() {
const qr = qrcode(0, 'H');
qr.addData('Hello, world!');
qr.make();
}
But it throws a runtime error:
Uncaught ReferenceError: qrcode is not defined
data
arg seems to be string. Can i pass an Uint8Array? That would bypass this line:
Line 1696 in 1379cf5
Problem
can i generate qr code for personal picture or this not possible ?
What i Try
I already can generate qr code using message toolkit library by using c#
windows applications form to text only like address or phone or URL
I search for internet i found it can save image in public server and read by
using internet and this is best .
But I need to generate qr code for personal image meaning store image in qr code
Are this possible or not ?
Which library can used and free ?
Hello, I'd like to request that you add support for importing this library using native ES modules, like so:
import qrcode from 'https://unpkg.com/qrcode-generator/qrcode.js';
I would benefit from this when experimenting with QR codes locally, without a build process.
I would have created a pull request, but I am not sure how to feature detect and export the library. Theoretically all you need to do is to add export default { ... }
, but in browsers where ES native modules are not supported yet, this would have caused an error to be thrown. At the same time, export
cannot be stated conditionally, so feature detection for native ES modules and then export doesn't seem to be possible.
I know you are not using a build process, so I am not going to suggest you create two variants, one with ES module support and one without, because this is not a pressing issue at all (can always just use script
and find what I need on window.qrcode
), but I am interested if you have any thoughts on how this could be achieved without introducing a build process.
Hi. When I try the alphanumeric mode, with any text (e.g. "here comes qr", it throws an error "Uncaught illegal char :h" in the console and no qr code is displayed. Is it a known issue and is going to be fixed?
Some issues with the code:
case QR_MODE_NUMBER :
$d = new QRNumber($data);
$this->addDataImpl($d);
break;
case QR_MODE_ALPHA_NUM :
$d = new QRAlphaNum($data);
$this->addDataImpl($d);
break;
case QR_MODE_8BIT_BYTE :
$d = new QR8BitByte($data);
$this->addDataImpl($d);
break;
case QR_MODE_KANJI :
$d = new QRKanji($data);
$this->addDataImpl($d);
break;
https://my.url.site/events/?eme_check_attendance=1&eme_pmt_rndid=5c4ac78bdaef8_8a5fe7041234573e19e7f9db6ba4fe38
$qr = QRCode::getMinimumQRCode($my_example_url,QR_ERROR_CORRECT_LEVEL_H);
Data capacity in the table on test page https://kazuhikoarase.github.io/qrcode-generator/
do not match the max values indicated here http://www.qrcode.com/en/about/version.html
For TypeNumber 1, your table has the following values :
While official values are :
It seems like the whole table has been reversed.
It doesn't look like code encoding is configurable. I'm trying to use Binary encoding, but I can't switch between Number & Binary encoding.
Is this supported?
Could someone please upload a new Version of the qr-code generator to npm?
Thanks a ton!
This isn't an issue. I apologize for posting here. I'm wondering if you can help show me how to get this QR Code generator to work on the p5.js online editor? It's part of a project I'm working on where I want to generate colorful QR Codes. If you can help I'd greatly appreciate it!
Please remove the obfuscated code by a publicly review-able version, we don't want or need malware in a library like this...
I'm trying to remove the white border/padding around the QR code. Is there any option to generate a QR code without a white frame around?
Thanks
Hello,
In order to be able to follow-up new version of qrcode.js, is it possible to add tags in the github repository when a new javascript version is released?
It's been a while since this project has made a release. I'm working on packaging it for Fedora, and it would be nice to have a recent release. Thanks!
Can I manually force the generator to encode data using Alphanumeric mode, instead of Binary mode?
I'm finding out that for a Version=2, DataCorrection=H, I can only fit 14 characters into the QR code. This is inline with the character limits for a "Binary" QR Code. However, I want to encode with Alphanumeric.
It looks like the generator only accepts Version and DataCorrection inputs, and does not allow you to specify mode (Binary, Alphanumeric, Kanji, Numeric). Am I missing something?
Hi,
I have a namespace collision between your library and this one (QR code reading library).
Both define the qrcode
object.
What is your recommendation for fixing this ?
Hi, I'm trying to use this with Angular2, but I don't see a documentations explaining how to use with typescript, is a detailed documentation a possibility in the future?
I have some questions. I want to ask.Thanks.
when i code like this:
var typeNumber = 4; var errorCorrectionLevel = 'L'; var qr = qrcode(typeNumber, errorCorrectionLevel); qr.addData('here comes qr!here comes qr!here comes qr!here comes qr!here comes qr!here comes qr!here comes qr!here comes qr!here comes qr!here comes qr!here comes qr!'); qr.make(); document.getElementById('placeHolder').innerHTML = qr.createImgTag();
For some reason, I can't use especially “createElement” .from "sample.js":
`var body_loadHander = function() {
var crtOpt = function(value, label) {
var opt = document.createElement('option');
opt.appendChild(document.createTextNode(label) );
opt.value = value;
return opt;
};
var t = document.forms['qrForm'].elements['t'];
t.appendChild(crtOpt('' + 0, 'Auto Detect') );
for (var i = 1; i <= 40; i += 1) {
t.appendChild(crtOpt('' + i, '' + i) );
}
t.value = '0';
update_qrcode();
};`
I'm curious about what it's going to do。And especially when I delete that method.
I remember that this library used to support type number setting equal to -1 for automatically finding the optimal (1~40) version number and avoiding the problem when there's more text supplied for the QR Code than that type could hold.
Is there a way to implement the same kind of logic outside of the library, including the support for UTF-8?
Could you add UTF-8 character encoding?
Hello, I am confused as on how to import the Kanji qrcode_SJIS
file in Node.js. When I tried:
const qrcode = require("qrcode-generator")
require("qrcode-generator/qrcode_SJIS")
const qr = qrcode(0, "L");
qr.addData(`敦煌天空的沙礫帶著我們的記憶`, `Kanji`);
qr.make();
console.log(qr.createSvgTag());
it died on an reference error in the qrcode_SJIS
saying that qrcode
is not defined 😕
Can you please provide an example on how to do this?
Hi
After these two are merged
The only extra step is to publish on npm.
From the js folder
npm adduser
npm publish ./
Thanks
Hey, i made this out of your implementation:
https://github.com/chillerlan/php-qrcode
Thanks for your work!
Looked through the code and nothing jumped out at me.
Thanks
Will you be adding typings definition for this library ?
Wish I could use it in an angular2 and Ionic 2 project
I see your Javascript is useing a lot of string versions for the tag(s) generated, and the final product needs to be added using innerHTML=
.
Could you please convert those to use real DOM-Element objects, so the final result can be applied to a DOM-Element also?
Eg. use createElement etc....
Please make readme.md file for this code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.