Giter VIP home page Giter VIP logo

qr-code-styling's People

Contributors

dd-jonas avatar dependabot[bot] avatar justraman avatar knom avatar kozakdenys avatar quadrocompile avatar seebeen avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

qr-code-styling's Issues

Two svg-typed qr-codes in one page. Generates same qr-code for all two instances.

Type of qr-code must be "svg". For "canvas" type works correctly.
Moreover, settings of one reflects on another.

For this code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>QR Code Styling</title>
    <script type="text/javascript" src="https://unpkg.com/[email protected]/lib/qr-code-styling.js"></script>
</head>
<body>
<div id="qr_1" style="display: inline;"></div>
<div id="qr_2" style="display: inline;"></div>

<script type="text/javascript">

    const qrCode1 = new QRCodeStyling({
        width: 300,
        height: 300,
        type: "svg",
        data: "https://www.facebook.com/",
        image: "https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg",
        dotsOptions: {
            color: "#4267b2",
            type: "rounded"
        },
        backgroundOptions: {
            color: "#e9ebee",
        },
        imageOptions: {
            crossOrigin: "anonymous",
            margin: 20
        }
    });
    
    const qrCode2 = new QRCodeStyling({
        width: 290,
        height: 290,
        type: "svg",
        data: "https://www.google.com/",
        dotsOptions: {
            color: "#4267b2",
            type: "rounded"
        },
        backgroundOptions: {
            color: "#e9ebee",
        },
        imageOptions: {
            crossOrigin: "anonymous",
            margin: 20
        }
    });

    qrCode1.append(document.getElementById("qr_1"));
    qrCode2.append(document.getElementById("qr_2"));
    //qrCode.download({ name: "qr", extension: "svg" });
</script>
</body>
</html>

Expected:
image

Got:
image

Sample:
https://jsfiddle.net/mz0kwdp2/13/

cannot start package within a node server

The documentation says that qr-code-styling/lib/qr-code-styling.common.js should be referenced but that file does not exists.

When trying to use it from server it says

Error: Cannot find module 'qr-code-styling/lib/qr-code-styling.common.js'

and when i substitute this reference

const { QRCodeStyling } = require("qr-code-styling/lib/qr-code-styling.common.js");

for this

const { QRCodeStyling } = require("qr-code-styling/lib/qr-code-styling.js");

it says
ReferenceError: self is not defined
at Object. (C:\www\qrGenerator\node\node_modules\qr-code-styling\lib\qr-code-styling.js:1:208)

Possibility to add arbitrary text, or margin to the QR-Code

Hi,

first thing first, thanks for the library!

Now, about the feature request, would it be possible to allow the user to add some text around the QR-Code ?
I would be interested by something looking like that:
image

If adding such a feature wouldn't respect the scope of the library, then a simple margin around the QR-Code would be enough, as it would allow user to add manually the text with something like this:

// var ctx = $0.getContext("2d"); //getting the canvas context in the debugger
ctx.font = "30px Arial";
ctx.fillText("Hello World", 100, 100); 

What do you think about this idea ?

Canvas remains empty

I'm trying to use the library in my custom element like this:

	const qrCode = new QRCodeStyling({
		width: 300,
		height: 300,
		//type: "svg",
		data: "https://www.facebook.com/",
		image: "https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg",
		dotsOptions: {
			color: "#4267b2",
			type: "rounded"
		},
		backgroundOptions: {
			color: "#e9ebee",
		},
		imageOptions: {
			crossOrigin: "anonymous",
			margin: 20
		}
	});

	let canvas = document.createElement('canvas');
	this.append(canvas);

	qrCode.append(canvas);

But the canvas remains empty. What's going wrong?

Node support was dropped, right?

Hey, just wanted to try this library with Node according to the readme, yet the build doesn't seem to accommodate this option, i'm I right or am I missing something? Thanks

Unable to access svg string directly

Hi there!

For my project I just need the svg string generated using QRCodeStyling instance. For now I am using the append method and extracting the svg string from a virtual element.

const qrCode = new QRCodeStyling(options)
const container = document.createElement('div')
qrCode.append(container)
const svg = container.innerHTML

I was wondering if there was a more elegant way of doing this?

Is it possible to extent the qr code to fill the canvas

I have a responsive design, the size of the canvas where I want to show the QR code can vary. How to I make the QR code the same size as the canvas.

I've tried setting the width and height to:

  • auto: Error: The provided double value is non-finite.
  • 0: Error: The canvas is too small
  • 10000: QR code is now to big for the canvas
  • Not at all: Generates at default size

Has anybody another suggestion?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.