jeromeetienne / jquery-qrcode

qrcode generation standalone (doesn't depend on external services)
http://blog.jetienne.com/blog/2011/04/07/jquery-qrcode/
MIT License
4.84k stars 2.51k forks source link

typeNumber doesn't work 1-40 #128

Closed Taeslash closed 4 years ago

Taeslash commented 4 years ago

Hi All,

I'm struggling to find option to generate a QRcode smaller, we can specify the size, but the QR code stays with high version. Trying to change the typeNumber option doesn't change it between 1-40, wondering if there is a bug here. I want to generate a small version 2 QR code, actually not possible, what should be the option?

here example of my code (with lots of options tests xD): $j('#qrcode').qrcode({ render : "canvas", // canvas, table, png width: 128, height: 128, typeNumber: -1, correctLevel: 1, / seems to reduce a bit the type, previous option doesn't seem to work from 1-14/ / pixelsPerTile: 10, --> doesn't seem to work/ padding: 0, border: 0, background: "#ffffff", foreground: "#000000", text : url });

As I understand, to solution my problem I should enter "typeNumber: 2" --> but QR code is not generated and there is an error in the console log: code length overflow. (1012>272)

EDIT: So what I want to achieve is control or have proper version generated depending on the size: https://www.qrcode.com/en/about/version.html

Taeslash commented 4 years ago

I've just got something, I'm trying to generate a QR code for an URL: "https://support-dev.epfl.ch/incident.do?sys_id=7bc293aadb10081079f593c8f49619f3&sysparm_domain_restore=false&sysparm_stack=no" --> I think I cannot do a version 1 with such a string. reducing the size of the URL presented already solves a bit the problem. (if we put "toto" as text, the version generated is 1).

Taeslash commented 4 years ago

As described in my last comment, the size / version of QR code cannot be so small as my string is too long.