Skip to main content
platm72
Inspiring
May 22, 2019
Answered

How to generate QR by script?

  • May 22, 2019
  • 2 replies
  • 7796 views

Hello,

I have  idea to generate QR codes from http links, by script.

Links will be wriiten as a text lines in a txt or doc file.

Help me please how to start coding the script. Where in API should i look for the methods and properties ? In which suite the QRcode engines egsist?

The QRcode itself is EPS, placed ino a frame, how to first generate the QR by javascript ?

My favorite documentation I always use is here:

https://www.indesignjs.de/extendscriptAPI/indesign14/#Application.html

Thank you for any suggestions

Marcin

This topic has been closed for replies.
Correct answer Dirk Becker

No need for external libraries.

You'd create or reuse an EPS page item, then invoke its create ... QRCode () method matching your type, e.g.

https://www.indesignjs.de/extendscriptAPI/indesign14/#EPS.html#d1e240502__d1e242534

The document has the same set of create methods, the QR code is then loaded into the place gun for manual place.

That's as far I remember it from some AppleScript experiments.

2 replies

platm72
platm72Author
Inspiring
May 22, 2019

Thank you very much :-) It's exactly what I need !

As allways the proper place to search is the point!

best regards marcin

Dirk BeckerCorrect answer
Brainiac
May 22, 2019

No need for external libraries.

You'd create or reuse an EPS page item, then invoke its create ... QRCode () method matching your type, e.g.

https://www.indesignjs.de/extendscriptAPI/indesign14/#EPS.html#d1e240502__d1e242534

The document has the same set of create methods, the QR code is then loaded into the place gun for manual place.

That's as far I remember it from some AppleScript experiments.

Jongware
Adobe Expert
May 22, 2019

No time to try, but as it is a method of all page items, would you not just invoke it on an empty rectangle?

Jongware
Adobe Expert
May 23, 2019

https://forums.adobe.com/people/%5BJongware%5D  wrote

No time to try, but as it is a method of all page items, would you not just invoke it on an empty rectangle?

And now I've tried it. It is indeed very easy: if you have a handle to an existing rectangle, you can immediately call its own createHyperlinkQRCode method, and the only argument it needs is the URL itself. (Unless you want to change the color etc., but see grefel's documentation for that.)

A one-line test shows this creates the exact same QR code as when done through the interface. In the image below, the left is a QR code generated with the menu option "Generate QR Code", type Web Link, and the right a blank rectangle that, when selected, gets filled with the same URL using the magic line

app.selection[0].createHyperlinkQRCode ("https://www.indesignjs.de/extendscriptAPI/indesign14/#EPS.html#d1e240502__d1e242534");