Using QR Codes
Learn how to insert custom QR Codes in your PDF documents using PDFMonkey.
When creating documents like flyers, shipping or packaging slips, or vouchers, our QR Code friend is now a np-brainer. We need it, period.
Here is how you can quickly get a QR Code for any dynamic data in your PDFMonkey template.
Paid account only
This technique uses JavaScript and is thus only usable on a paid account or during your 14-day trial.
JavaScript libraries
QR Code is not something new and, as you can expect, the JavaScript world is filled with libraries for it. Some are good, some others… exist.
Here are some pretty simple options we recommend:
bitjson/qr-code
This library offers a very simple web-component you can use to insert a QR Code in your document. It has no dependencies so you can simply link to the library using a CDN and insert the component in your code:
Avoid animations
Animations and PDF rendering usually don't play nice. Avoid copy/pasting pieces of code that use animation, or removing the animation part, otherwise the QR Code might not finish its animation before "printing", resulting in an absent or incomplete QR Code.
Dots-only
The main drawback of this library is that your stuck with the style of the dots. You can only get circles.
QRCode.js
For a more "classic" looking QR Code, the QRCode.js library is a good option. It doesn't offer much customization but it should be good enough in most cases.
Last updated
Was this helpful?