Skip to main content
Known Participant
January 16, 2025
Question

How to find and edit QR Codes using scripting

  • January 16, 2025
  • 4 replies
  • 4187 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!!

Known Participant
January 23, 2025

Hi @James Gifford—NitroPress I'm no expert on this, but I'm confident enough to answer your two questions

 

> ... whether ID stores that (text or equivalent) data somewhere, as a separate, theoretically editable element, independently of the little dotty graphic. 

 

It definitely does store it somewhere "alongside" the QR code graphic. We know that because of the snippet trick. However we don't know where. It could be, for example, an "inserted label" of the graphic or frame (aside: I wish we could get a list of all of an objects labels to extract!) or, more likely, simply an internal property that we have no access to aside from the snippet trick. The fact that the contents are exposed when exporting a snippet is surprising to me—I mean why not just export the graphic alone? The fact that it re-generates, as Robert noticed, is even more surprising.

 

>  does it simply "read" the code to produce the re-editing data/string?

 

No it doesn't read the QR Code graphic at all. Therefore this workaround only works with Indesign-generated QR codes. I looked into the feasibility of decoding a graphic QR code via script but it was too involved.

 

For now it seems that OP's workaround is pretty much the best we can do, unless I'm missing something.

- Mark


I did try to be a bit sneaky, parsed the graphic object, then wrote all the data fields to a JSON file to see if I could find any "hidden" data. But unfortunately, I didn't see anything new. Again... it really boggles my mind that Adobe would do things this way. You can see the URL just by hovering your mouse over the QR Code... So you KNOW the data is there somewhere! Fer cry'n out loud, just let us open and edit it in scripting just as you would with the "Edit QR Code" dialog. Is it really too much to ask?

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?