Skip to content
Advertisement

Create QR-Code in vector image

I can successfully create QR Code PNG images with ZXing but there is no easy way to get the output as SVG or EPS.

How can I create a vector image from the BitMatrix object that is created by the QRCodeWriter?

Advertisement

Answer

The easiest way I found was to create a PDF with iText and then convert the resulting PDF to EPS or SVG. Here is the code to create the PDF:

JavaScript

I then use image magic for the conversion. Like so:

JavaScript

the same can NOT be done for svg

JavaScript

this does not work

I tested this code with some long content and it worked with up to 600 characters. This is probably down to the precision of either camera on the phone or screen.

I hope this helps someone

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement