• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Stop User from Working in Browser?

Explorer ,
Mar 20, 2019 Mar 20, 2019

Copy link to clipboard

Copied

Hi there,

This may not be the correct forum to ask this question, but I figured I'd start here first...

More and more, I am running into problems with employees who do not understand the difference between opening a PDF in Adobe Reader, vs. opening a PDF in their browser. I have given tutorial after tutorial on how to avoid this, but it never seems to stick. I'm constantly getting phone calls saying "my formula won't work" or "when I click the button nothing happens", and it's ALWAYS because the user didn't properly download the file.

I'm hoping that there might be a script to prevent the user from doing anything to a document if it's open in say, Google Chrome vs. Adobe Reader. Or perhaps, have the document just be one page with a button that says "START", that you can only click if it's open in Adobe.

Any thoughts?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

435

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2019 Mar 20, 2019

Copy link to clipboard

Copied

This is currently a major issue for many of us. Unfortunately, there's not much that can be done about it.

The best solution I've been able to come up with is to place a very large, very visible warning on the first page of the file and then use a script to hide it when it is opened in Adobe Acrobat or Reader. If it is opened in another application (even if it doesn't support scripts) the warning will remain visible and the user will have at least some kind of indication that something is wrong.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2019 Mar 20, 2019

Copy link to clipboard

Copied

Thanks so much - that's along the lines of what I was thinking. If I can't stop them completely, that would at least make them stop and think for a second.

I found this script in the SDK Documentation - is this the approach you'd recommend?

if ( this.external )

   {

     //Viewing from a browser

   }

   else

   {

     //Viewing in the Acrobat application.

   }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2019 Mar 20, 2019

Copy link to clipboard

Copied

No, I would do it like this:

if (/Reader/.test(app.viewerType) || /Exchange/.test(app.viewerType)) this.getField("WarningCover").display = display.visible;

The "WarningCover" field should be an opaque, read-only field (maybe a button) placed above a static warning text and made hidden. The code will make it visible when you open the file in Acrobat or Reader, thereby covering the warning.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 01, 2019 Apr 01, 2019

Copy link to clipboard

Copied

This is an additional countermeasure that may work for you: If your Webmaster can format the code behind the form's link with "<a download= ...." instead of "<a href= ...." (see HTML a download Attribute), then the form (or any file) should download instead of displaying within the browser.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 02, 2019 Apr 02, 2019

Copy link to clipboard

Copied

LATEST

That's a good solution!! although not supported by all browsers.

As to the "WarningCover", it needs to be Fail Safe. This means that if the document is opened in a PDF viewer that does not implement JavaScript, then the "WarningCover" is already in place.  So don't make it hidden. 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines