Copy link to clipboard
Copied
I have a PDF template with form fields in Adobe Acrobat that has a barcode object set to QR code. There is a hidden textbox that contains the information the QR object is supposed to encode-in my case it is a shortened URL that will change depending on the item name. When I edit the PDF and manually set the hidden textbox to the URL, the QR code updates just fine and directs to the proper site. However, the QR object will not update and display correctly when I pass the URL into the textbox through a vb.net application. It's passing the same value as what I manually entered and I even set the form field manually in the application just in case there was a discrepancy in the value I was retrieving from SQL. I have also tried changing the value to a custom calculation script and making sure the textbox values passes as a String. The QR code still will not update and displays only the textbox's field name; sometimes it won't scan at all.
I have not been able to find any answers online that deals with this kind of problem. Any suggestions?
Copy link to clipboard
Copied
The PDF appearance of the Barcode field can only be updated by an application that is displaying the PDF at the time the barcode value is changed, understands how the barcode needs to be updated, and has the capability to do so. Basically Acrobat Pro. Possibly one of the better PDF viewers or one of the Adobe server side apps/services.
Acrobat Reader will not update the barcode because it requires special "Reader Rights" to do so. Nearly all mobile apps and web browsers completely worthless when it comes to PDF forms, and espeically the more specialized PDF form elements.
So how exactly is this vb.net app updating the barcode value?
Copy link to clipboard
Copied
Hm, so even if I am using Adobe Acrobat to open the PDF once those values have been passed, it still won't display the correct QR code because the application that updated it wasn't Acrobat? Is there any way to dynamically change a QR code on a PDF then?
I am using form fields, PdfReader/PdfStamper, and AcroFields to pass information to the PDF template.
Copy link to clipboard
Copied
Yes, you should be able to "Kick" Acrobat to update the barcode field.
You said that the value is loaded into a separate text field, and that the barcode field uses a calculation script to grab this value. If so, then try putting this line in a document script:
this.calculateNow();
This only works if the barcode Value is not already set to the new value. So if this isn't working, then delete the calculation script and use a manual copy in the document script
this.getField("Barcode1").value = this.getField("Text1").value;
Copy link to clipboard
Copied
I've tried both of these scripts and the QR code doesn't update when Acrobat is opened. It will update when I go into the properties of the object, change something, and save however.
Copy link to clipboard
Copied
Seems like the calculation is not getting triggered.
Try this. Remove the scripts (anything that might affect the barcode or hidden field), then run your server side filler. Open the PDF in Acrobat and see what the values are in both the barcode and the hidden field.
Copy link to clipboard
Copied
The hidden field is set to the URL and the barcode says it's pointing to the hidden field but it has a blank value.
Copy link to clipboard
Copied
Without seeing your file it's hard to tell why the value is not being copied over automatically. One solid solution is to do the copy explicitly from a button script. Not ideal, but it will work.
If you want to do further debug on the automatic technique you'll need to put some console.println statements in the code to see what is triggered when. You could even try a document script that compares the barcode to the hidden field and forces a transfer if they are different.
Here's a video tutorial on using the console for debug.
https://www.pdfscripting.com/public/images/video/AcroJSIntro/AcroJSIntro_ConsoleWindow.cfm