Skip to main content
Known Participant
January 16, 2025
Question

How to find and edit QR Codes using scripting

  • January 16, 2025
  • 4 replies
  • 4056 views

There appears to be several methods available in order to create QR Codes within the Scripting API. What we need is a way to find each QR Code and examine/edit the URL. There apprears to be nothing listed for this within the API documentation. Is there any way to step through the Graphics in each doucment, determine whether or not they are QR Codes, and if they are, to then check/edit the URL? 

4 replies

M S V
Inspiring
January 31, 2025

hi 

looking in the properties of the links in an Indesign document

I've seen then QRCodes generated in Indesign have

the name starting with "QR Codexxxxx" and the status link embedded

so you can make an array of all links and test name and status to find every QR Code

Robert at ID-Tasker
Legend
January 31, 2025
m1b
Community Expert
Community Expert
January 17, 2025

Hi @Ken Webster, do you create all the QR Codes in-house? Or are they existing QR Codes that come from other sources? It's a strange question, but I'm asking because I can think of possible solutions to this but it only works going forward with newly-created QR Codes that you've made in-house. This is probably a deal-breaker, but you can let me know.

- Mark

Known Participant
January 22, 2025

Long story short - We (I) found a somewhat painful solution. I took the code that Sunil Yadav posted in another thread and modified it. He basically takes the PageItem object holding the QR Code, writes it to file as XML, reads the file back in and looks for the QRCode tag. It's not very elegant and it's clunky, but it works... for the most part. There's an old saying about "Walking all the way around the block just to go next door" Well, this is like hoping on a flight to Europe to buy a soda.
Dear Adobe... QR Codes have been around for over 30 years. YOU NEED TO DO BETTER!!

Community Expert
January 23, 2025

Got it. Unfortunately that means it only works if the QR Code was generated by Indesign. Still it would be sensible to be able to access that value via the scripting APIs, especially since the value exists, as the snippet shows. I've created a feature request for this

 

@Ken Webster I doubt that Adobe sees many of these posts, so please vote on the feature request and leave a comment there if you have better ideas than my quick one.

- Mark


@m1b said: "I've created a feature request for this".

 

Hi Mark,

I voted.

 

ExtendScript

Currently we have several methods of creating QR codes.

The universal one is:

 

createPlainTextQRCode()

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Graphic.html#d1e258171__d1e260352

 

Others that are listed are:

 

createEmailQRCode()
createHyperlinkQRCode()
createTextMsgQRCode()
createVCardQRCode()

 

 

So I would suggest the following new methods:

 

 

readPlainTextQRCode()

 

( from existing QRCode )

 

 

writePlainTextQRCode()

 

( to existing QRCode )

 

Maybe also pairs of read/write methods for the Email, Hyperlink, TextMsg and VCard kinds.

But basically we are good with PlainText, because every of the four kinds of QR codes listed additionally can be done with PlainText.

 

For all who like to vote:

 

[Scripting] Edit QR Code
It would be good if we could read the contents of an Indesign-generated QR Code via script.
@m1b, January 22, 2025 ·
https://indesign.uservoice.com/forums/601021-adobe-indesign-feature-requests/suggestions/49362638--scripting-edit-qr-code

 

Thanks,
Uwe Laubender
( Adobe Community Expert )

Robert at ID-Tasker
Legend
January 16, 2025

 

Robert at ID-Tasker
Legend
January 16, 2025

Can't check right now - but i think QR codes are stored as Embedded EPS files. 

 

Known Participant
January 16, 2025

Yes they are.. But we still need a way to determine if the embedded EPS file is a QR Code, and then read the URL string.

Robert at ID-Tasker
Legend
January 16, 2025

I don't think there is a way to read it back - from a script?