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

Web Browser

Participant ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

Hi.  Is there a code to add to a PDF form to prevent it from opening in a web browser?  I have a form with password protections that are bypassed when the form is opened in a web browser due to the user not having a pdf reader installed.

TOPICS
PDF , PDF forms

Views

771

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

correct answers 1 Correct answer

Community Expert , Jan 30, 2024 Jan 30, 2024

You can try it with this code, but be aware it's not fool-proof. It could very well be that some PDF viewers are so bad they won't show the field at all, causing the underlying contents to be revealed...

 

if (app.viewerType=="Reader" || app.viewerType=="Exchange" || app.viewerType=="Exchange-Pro") {
	this.getField("CoverField").display = display.hidden;
}

Votes

Translate

Translate
Participant ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

I got an idea from another post, but I don't know how to make it work.  I created a read-only text field (visible but doesn't print) and expanded it over the entire page.  The field states "You must have a PDF reader installed or print it to use this form".  I need to know where to place a code similar to the 1 below to make the text field visible if the form is opened in a web browser and hidden if opened in a pdf reader.  

if (app.viewerVersion < 9) {
this.getField("theWarningField").display = display.visible;
    }
else if ( app.viewerVersion >= 9 ) {
this.getField("theWarningField").display = display.hidden;
}

 

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 ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

You can try it with this code, but be aware it's not fool-proof. It could very well be that some PDF viewers are so bad they won't show the field at all, causing the underlying contents to be revealed...

 

if (app.viewerType=="Reader" || app.viewerType=="Exchange" || app.viewerType=="Exchange-Pro") {
	this.getField("CoverField").display = display.hidden;
}

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
Participant ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

Thanks. This seems to work.  I can't fully test it because a have a reader on my computer.  However, I did a preview in a browser window and saw the field.  

 

I ended up placing a dcument script: 

if (app.viewerType=="Reader" || app.viewerType=="Exchange" || app.viewerType=="Exchange-Pro") {
	this.getField("CoverField").display = display.hidden;
}

I also added the following script under document actions > Document Will Close so that the field reapears for the next user:

if (app.viewerType=="Reader" || app.viewerType=="Exchange" || app.viewerType=="Exchange-Pro") {
	this.getField("CoverField").display = display.noPrint;
}

 

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
Participant ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

Well, it seems I have a problem with this.  If I go to close it, then, hit cancel, the CoverField field is visible and doesn't go away.

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 ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

If a PDF viewer doesn't support JS, then you can't use  JS to do something.  The setup has to be failsafe, meaning it works when JS isn't supported.   So make the field visible to start, then use the JS to make it hidden (as shown by Try67). If the viewer is does not support JavaScript, or is an old Acrobat, the field stays visible.

 

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
Community Expert ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

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
Participant ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

I need to try this method as I had problems with using the above method.  I don't have the programs listed.  Is there 1 that doesn't have to be purchased just to add a layer.

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 ,
Aug 13, 2024 Aug 13, 2024

Copy link to clipboard

Copied

LATEST

The simpliest way is placing the PDF form into a PDF Portfolio.

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 ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

To ensure your PDF form is opened in a dedicated PDF reader and not a web browser, follow these steps:

 

1. Add a Warning Message: Include a note on the first page of the PDF:
> "Please open this form in Adobe Acrobat Reader to maintain password protection and functionality. Opening in a web browser may disable these features."

2. Host PDF for Download: Provide a download link on a web page with a clear instruction:
> "Download and open with Adobe Acrobat Reader. Browser viewing may bypass security."

3. Use PDF Features: Utilize advanced form features or JavaScript that require a dedicated PDF reader, discouraging browser use.

 

Adobe Community Profile 

https://youtubethumbnaildownloaderonline.com

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