Generate QR code – ZXing library


does anyone ever worked with the ZXing library? I am trying to generate QR codes with this library in processing. So when open the example sketch “generateQRCode” there is always the same error:

The package “com.cage” does not exist. You might be missing a library

I tried to reinstall the library to my library folder but there is still the same problem.
Maybe someone had the same problem before or knows an other library to generate QR codes?

This one is a strange one for ZXing and is actually just about renaming the folder.

STEP 01:
When you install the library, it appears with folder name zxing4p3-v3.4
Now, change it to just zxing4p3

STEP 02:
Go to the example called decodePImage>data and copy the font ArialMT-14.vlw
Create a ‘data’ folder in the generateQRCode example. There is no ‘data’ folder present here.
Then rename ArialMT-14.vlw to ArialMT-18.vlw

STEP 03:
Run sketch.

Hopefully this should help. Cheers! :slight_smile:

1 Like

Thanks for your reply, but i still get the same error!51

Sorry mate… didn’t realize that you might be on a Mac… it worked on PC for me though. Had this issue before and your post prompted me to give it a try once again. Not familiar with Mac under the hood though :slightly_frowning_face:

This is what I see after I made those changes. Added in the text ‘My QR code test’


I do not know what I did wrong earlier but I have repeated your hint again and now it works.
Thanks, your are great!


Glad to know you were able to get it to work Felix. Just one thing… the font bit is a hack. Do replace with a properly created .vlw file as I believe .vlw files are texture based and not vector based. Changing 14 to 18 was just a fast way to get it to work but the text is not smooth/crisp as you can see.

Here’s an excerpt from loadFont() help page:

Create a .vlw font by selecting “Create Font…” from the Tools menu. This tool creates a texture for each alphanumeric character and then adds them as a .vlw file to the current sketch’s data folder. Because the letters are defined as textures (and not vector data) the size at which the fonts are created must be considered in relation to the size at which they are drawn. For example, load a 32pt font if the sketch displays the font at 32 pixels or smaller. Conversely, if a 12pt font is loaded and displayed at 48pts, the letters will be distorted because the program will be stretching a small graphic to a large size.

1 Like