Skip to main content
Participant
October 13, 2021
Answered

Check, if PDF form is opened by Acrobat and not by a browser! Is check possible in javasrcipt?

  • October 13, 2021
  • 2 replies
  • 1782 views

We are using PDF-Forms,which include calculations. If opened in Acrobat Reader,everything is OK. If the user opens the forms in a Browser like Edge oder Chrome, the calculations are wrong.

 

Can I check in javascript, if the form is opened by Acrobat? If not, I would like to send an alert and recommend to close the form and open it in Acrobat.

 

Is this possible?

 

Best regards, Matthias

This topic has been closed for replies.
Correct answer default1cobxv92fgkj

Problem solved:

 

function init()
{
if (app.plugIns.toString().indexOf("ADBE") > 0) {
this.getField("Adobepruefung").display = display.hidden;
this.getField("Senden").display = display.visible;
}
else {
app.alert("I'm NOT in an Adobe viewer")
}
}
init();

2 replies

JR Boulay
Community Expert
Community Expert
October 15, 2021

All PDF form makers should know this great trick which detects low-end PDF readers in addition to browsers:

(copy paste this URL into Google Translate)

https://www.abracadabrapdf.net/ressources-et-tutos/js-et-formulaires-ressources/forcer-utilisation-pdf-avec-acrobat-reader/

Acrobate du PDF, InDesigner et Photoshopographe
Participant
October 13, 2021

By thinking about it, I decided for a different soultion. I place a huge text-box over the form and made the "send"-Button for the form unvisible. 

 

When being used in Adobe Acrobat with javascript, I change the huge field to unvisible and the "Send"-Button to visible. This only works in Adobe an using javascript.

 

There is still something; i would like to know, as I'm a beginner:

  • HOW CAN I RUN THE JAVASCRIP WHEN THE FORM IS LOADED? 

So far, the schript is running, when the cursor get over the field...

default1cobxv92fgkjAuthorCorrect answer
Participant
October 15, 2021

Problem solved:

 

function init()
{
if (app.plugIns.toString().indexOf("ADBE") > 0) {
this.getField("Adobepruefung").display = display.hidden;
this.getField("Senden").display = display.visible;
}
else {
app.alert("I'm NOT in an Adobe viewer")
}
}
init();