How to Detect Adobe Reader vs Acrobat Pro Using JavaScript in PDF Forms
Question details
Form designers want to dynamically hide or show interactive PDF form controls based on whether the user is opening the file in a free PDF reader or a professional PDF editor.

- Product
- Adobe Acrobat / PDF Forms
- Device & OS
- not provided
- Scenario
- Designing interactive and fillable PDF forms with conditional button visibility.
- Observed behavior
- Specific buttons should be hidden in Adobe Acrobat Reader but visible in Acrobat Pro or Standard.
Ensure you have access to a professional PDF editing tool that supports adding document-level JavaScript and configuring interactive form fields.
Use the app.viewerType Property to Control Button Visibility
Implement document-level JavaScript to identify the PDF viewer type and toggle the display settings of your target buttons automatically.
The app.viewerType property evaluates the type of application opening the PDF. It returns 'Reader' for Adobe Acrobat Reader and 'Exchange' for Acrobat Pro or Standard.
By combining this property with a simple conditional statement, you can dynamically change a form field's display attribute (using display.hidden or display.visible) as soon as the document is opened.
Launch your professional PDF editor and open the interactive PDF file you want to modify.
Navigate to the JavaScript settings menu (often found under the Tools or Form section) and select 'Document JavaScripts'.
Click to add a new script, assign it a recognizable name such as 'CheckViewer', and open the code editor.
Enter the following logic: if (app.viewerType == 'Reader') { this.getField('YourButtonName').display = display.hidden; } else { this.getField('YourButtonName').display = display.visible; }
Save the JavaScript and the PDF document. Open the file in both the free Reader and the Pro version to verify the button visibility changes accordingly.

Edit and Manage PDF Forms Easily with WPS Office
While advanced JavaScript configurations are specific to individual PDF viewer environments, WPS Office provides a robust, user-friendly PDF editor. You can seamlessly fill out interactive forms, edit text, and manage your PDF files without needing complex scripting.
- 1. Download WPS Office: Download and install WPS Office from the official website to access the built-in PDF tools.
- 2. Open your PDF document: Launch WPS Office and open your interactive PDF form directly within the application.
- 3. Fill and interact with forms: Use the 'Form' tab to interact seamlessly with text fields, checkboxes, and buttons.
- 4. Save or export: Once completed, easily save your modifications or export the document securely to share with colleagues.

Frequently Asked Questions
What does app.viewerType return in Adobe Acrobat?
The app.viewerType property returns the string 'Reader' when the document is opened in Adobe Acrobat Reader, and 'Exchange' when opened in Adobe Acrobat Pro or Standard.
Can I hide multiple form fields at once using JavaScript?
Yes. You can place multiple this.getField('FieldName').display = display.hidden; statements inside your conditional block, or loop through an array of field names to hide several buttons simultaneously.
Where do I add document-level JavaScript in a PDF?
In professional PDF editors like Acrobat Pro, you generally navigate to the Tools menu, select 'JavaScript', and click on 'Document JavaScripts'. From there, you can define scripts that execute exactly when the document opens.
Will this JavaScript work in non-Adobe PDF viewers?
Not necessarily. The app.viewerType property is specific to Adobe's JavaScript API. Other third-party PDF viewers might ignore this script or return an undefined value, which is why testing across multiple software platforms is recommended if your audience uses diverse tools.




