Ever needed to create a QR code? There are literally hundreds of free QR code generators on the web, but they all have the same drawbacks:
1. They typically deliver a PNG, either 'click here to download', or you have to drag it somewhere yourself.
2. It's typically an RGB image, so the cautious designer will start up Photoshop to convert it to a monochrome image.
3. .. so you get a file to store somewhere ..
4. ... and after seeing four of them you cannot remember which QR code said what ...
5. .... and, you cannot use such site in a batched environment (well, maybe some people can by building a proper URL, call the website, wait for a response, etc. I bet it's difficult for your average scripter.)
So I had a go on converting one of the existing Javascript solutions -- Patrick Wied's, in case you're curious -- into a construction fit for InDesign. All you have to do is download the zip: http://www.jongware.com/binaries/jw_qrcode.zip -- unpack it, and save the file "QRCode.jsxbin" in your local User Script folder. It ought to be compatible with InDesign CS4 and upwards, for both Mac and Windows.
When it appears in your Script Panel, you can double-click to run and
1. with nothing selected, it prompts for text and error recovery settings, and will place a proper monochrome TIFF bitmap of (approximately) a useful dimension in the center of your current page.
2. with an empty rectangle selected, the new QR code will be placed inside it.
3. with some text selected, the text field will be pre-filled with this.
4. With a QR Code selected which you created earlier using this same tool, the text field will contain the original text, and the quality setting will be retrieved. You can cancel the dialog if you only wanted to know what it said, or change the text or quality.
5. You can call this script from another script to perform batch operations. It accepts two required arguments, and one optional, in this order: text, Error Correction level (1-4), and optionally a destination rectangle to place it in:
app.doScript(new File(app.activeScript.path+'/qrcode.jsxbin'), ScriptLanguage.JAVASCRIPT, ["hello", 1, app.selection[0]], UndoModes.ENTIRE_SCRIPT, "Call QR Code");
6. Since it's a monochrome bitmap TIFF with enough resolution (at its default size it's 200 dpi), you can use the swatches palette to change the white or black parts to another color, or even make one transparent.
7. It's just a small file, and so I decided to always have it automatically embed. That way you can never loose it. The image first has to be created in a temporary file (default location: (Temp)/qrcode.tiff, where (Temp) is your local Temporary Files folder). If this fails for some of you (there always seem to be overly prudent IT professionals who seem to despise users storing files willy-nilly), I'll have to think of something else.
Note: this version only supports plain text mode, not numeric, alphanumeric, or Kanji. Text is converted to UTF-8; for the most common purpose -- web pages -- it should work normally.
Enjoy!
Based entirely on Patrick Wied's implementation of a basic QR Code generator. Patrick Wied dutifully notes
I do not guarantee any resulting QR code generations or detections, use this application at your own risk! - this project is just a study project (non commercial).
and so I advise to always check your generated code using a good QR Code reader.