Skip to main content
November 6, 2019
Question

PDF doc-level script to validate if QR code is there or not upon printing

  • November 6, 2019
  • 1 reply
  • 493 views

We have a PDF form with QR code (PDF has reader extension) that our users fills and prints along with the automatically generated QR code. In some PDF readers, the QR code isn't generated (Chrome PDF Viewer for example) and I would like to have a doc-level script alerting that the QR code was not generated upon printing the PDF. Can it be done and how?

PS: Here's the PDF, click on "Autre mode de transmission" and "Télécharger le formulaire" at the bottom (QR code is on the last page): http://www.afe.gouv.qc.ca/tous-les-formulaires/detail/detail/News/demande-de-prets-et-bourses/

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
November 6, 2019

The resaon the QR codes doesn't work in some viewers is because the either don't support JavaScript at all, like the Chrome PDF viewer, or they don't support the barcode fields. So you have a conumdrum.  If a viewer doesn't support scripting, and you need the script to do something, then how do you detect it?  

 

The answer is to obscure the PDF pages with a message warning the user they need to open the PDF in a compliant viewer, such as Acrobat Reader. Then have a document level script that removes the message. The only way the message is removed, is if the PDF is opened in a compliant viewer.  You'll find and example of this here, but it's not free:

Lite Document Security 

 

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often