Skip to main content
Participant
October 25, 2023
Answered

How do I create a QR code that links to the document location and place it on the artboard?

  • October 25, 2023
  • 2 replies
  • 671 views

I am looking for a way to create a QR Code that links to the file path/location of the current file and puts this QR Code in the bottom right corner the artboard. I have searched for plugins and scripts that will do this, but to no avail.

This topic has been closed for replies.
Correct answer m1b

Hi @JosephD333, I have adapted Kazuhiko Arase's QRCode.js for use with Illustrator. You can download the script files.

 

First you must put "QRCode.js" in the same folder as the following script, and try this:

//@include 'QRCode.js'

/**
 * Draws a QRCode containing the document's URI.
 * @author m1b
 */
(function () {

    var doc = app.activeDocument;

    // this URI might not be best for your situation
    var docURI = 'file://' + encodeURI(doc.fullName.fsName);

    // draw the QRCode
    var qr = new QRCode({
        text: docURI,
        doc: doc,
        left: 0, // points
        top: 0, // points
        width: 100, // points
    });

})();

 

Notice for your case the variable "docURI". I have made a file URI that works for me on MacOS. You might need to construct it differently for your specific needs. You also need to set the position and width to suit your artwork. You can also pass it colors and adjust QR code settings.

- Mark

2 replies

m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
October 26, 2023

Hi @JosephD333, I have adapted Kazuhiko Arase's QRCode.js for use with Illustrator. You can download the script files.

 

First you must put "QRCode.js" in the same folder as the following script, and try this:

//@include 'QRCode.js'

/**
 * Draws a QRCode containing the document's URI.
 * @author m1b
 */
(function () {

    var doc = app.activeDocument;

    // this URI might not be best for your situation
    var docURI = 'file://' + encodeURI(doc.fullName.fsName);

    // draw the QRCode
    var qr = new QRCode({
        text: docURI,
        doc: doc,
        left: 0, // points
        top: 0, // points
        width: 100, // points
    });

})();

 

Notice for your case the variable "docURI". I have made a file URI that works for me on MacOS. You might need to construct it differently for your specific needs. You also need to set the position and width to suit your artwork. You can also pass it colors and adjust QR code settings.

- Mark

Monika Gause
Community Expert
Community Expert
October 25, 2023
Participant
October 26, 2023

I hadn't seen this one! I do need it for printing and we use Thrive so I will check this out! Thanks.