Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I generate QR images in Node.js without canvas?

I'm building a website for a client in Node.js and I need to generate QR-codes or Barcodes for the ticket system.

I've found a few modules, but all of them need an install like canvas, one way or another.

I'm on a shared hosting package and my host does not allow me to install any such packages, unless I upgrade to a VPS or dedicated server (which I do not have the money for).

Does any of you know how I can pull this off in Node.js or do I need to put up a subdomain for generating the QR in PHP or front-end generating (which I do not prefer AT ALL)?

Currently using:

  • Node.js
  • Express.js
  • Angular.js

Modules found:

  • https://github.com/soldair/node-qrcode
  • https://www.npmjs.com/package/qrcode-npm
like image 669
CherryNerd Avatar asked Mar 15 '15 23:03

CherryNerd


People also ask

Can we generate QR code for image?

It is easy to convert an image to QR Code online with our QR Code Generator. Also known as Image Gallery QR Code, it is a QR Code solution that enables you to display not just an image, but multiple images in the form of a gallery.

How do I make an offline QR code?

How to generate an offline QR code using a QR code generator online software. Convert your data into an offline QR code using an offline QR code generator by following these simple steps. Click the QR code solution that you want to generate – Click whether you want to create a URL, email, or text offline QR code.


2 Answers

Have a look over this code:

var qr = require('qr-image');  
var express = require('express');

var app = express();

app.get('/', function(req, res) {  
  var code = qr.image(new Date().toString(), { type: 'svg' });
  res.type('svg');
  code.pipe(res);
});

app.listen(3000);

visit npm-qr-image

like image 176
Balaji L Avatar answered Sep 28 '22 23:09

Balaji L


You could use qr-image it is a full JavaScript solution using Buffers that generates QR codes in following formats: png, svg, eps and pdf formats

like image 33
Luscus Avatar answered Sep 28 '22 21:09

Luscus