Skip to main content
zeldabee
Participating Frequently
Aug 13, 2018 2:43 PM UTC
Answered

Insert QR code into PDF

I'm driving myself crazy trying to figure out a good way to drop a QR code into an existing PDF. I don't want to create a form, I simply want to add a QR code containing the file name into a print PDF (which has been generated from an imposition program that for some reason can't add one in itself). The QR code would be read by a scanner on a cutting machine.

I would be happy to use a plug-in if I could find one that just did what I wanted without a lot of other fancy stuff that I'd never use, and that would cost me an arm and a leg. Any advice would be appreciated, and if there's a better place to ask the question, let me know.

try67
try67Correct answer
Community Expert
Aug 13, 2018 2:57 PM UTC

Well, Acrobat has a built-in Barcode form field that can be set to display QR codes with a dynamic value. However, that value can't be changed in Reader, unless a very special right is applied to the file. So if you only need a static code then that could be the solution for you.

10 replies

Participant
Sep 25, 2024 2:52 PM UTC

Drag a "Text Field" and name it "WebsiteURL". You may change the name but you need to update the script accordingly. Very simple but important.

Then generate a Barcode and open the properties. Under the "Options" tab select the "QR code" from the "Symbology" menu. Then move to the Value tab and paste the script below by selecting "Custom calculation script", then click "Edit". After this, the QR Code will be regenerated every time you enter a link to the text field.

 

// Get the value from the WebsiteURL text field
var website = this.getField("WebsiteURL").valueAsString;

// Check if the website field is not empty
if (website !== "") {
// Ensure the URL starts with http:// or https://
if (!/^https?:\/\//i.test(website)) {
website = "https://" + website;
}
// Set the QR code value to the website URL
event.value = website;
} else {
// If the website field is empty, clear the QR code
event.value = "";
}

Translate
janp75387852
Participant
Oct 3, 2024 9:24 PM UTC

Thank you, gurbey_6134!!

 

Translate
Thom Parker
Community Expert
Community Expert
Dec 10, 2019 8:02 PM UTC

You would need to ask Adobe about the specific Right, or Reader Extenstion. But it won't be cheap. Most people find these "Rights" to be out of range. 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
Aug 13, 2018 2:52 PM UTC

Generate an image file that has the QR code in it, and then just add it to the PDF, like you would any other file.

Translate
zeldabee
zeldabeeAuthor
Participating Frequently
Aug 13, 2018 2:54 PM UTC

Yes, that is the only way I can do this now. It would get very tedious to do that to a hundred files.

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Aug 13, 2018 2:57 PM UTC

Well, Acrobat has a built-in Barcode form field that can be set to display QR codes with a dynamic value. However, that value can't be changed in Reader, unless a very special right is applied to the file. So if you only need a static code then that could be the solution for you.

Translate