Skip to main content
zeldabee
Participating Frequently
August 13, 2018
Answered

Insert QR code into PDF

  • August 13, 2018
  • 3 replies
  • 27335 views

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.

Correct answer try67

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.

3 replies

Participant
September 25, 2024

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 = "";
}

janp75387852
Participant
October 3, 2024

Thank you, gurbey_6134!!

 

Thom Parker
Community Expert
Community Expert
December 10, 2019

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. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
August 13, 2018

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.

zeldabee
zeldabeeAuthor
Participating Frequently
August 13, 2018

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

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
August 13, 2018

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.