PDF Security & Access Issues

How to Fix insertPages Security Settings Error in Adobe Acrobat

Chanuka GeekiyanageChanuka Geekiyanage Nov 3, 2026 868 views

Question details

The user needs a way to bypass the security settings error that occurs when triggering the insertPages() JavaScript command via a PDF button.

How to Fix insertPages Security Settings Error in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating an interactive PDF document containing a button designed to execute page insertion using JavaScript.
Observed behavior
The insertPages() command executes successfully from the JavaScript console but throws a security-settings error when triggered by clicking the PDF button.
Before you start

Ensure you have administrator access to your local computer, as fixing this requires creating and saving a custom JavaScript file into Adobe Acrobat's application folders.

Solution 1Recommended

Create a Trusted Function in a Folder-Level JavaScript File

Bypass Acrobat's document-level security restrictions by wrapping the privileged insertPages command inside a trusted function located in a local folder-level script.

Adobe Acrobat restricts privileged JavaScript methods like insertPages() for security reasons, preventing unauthorized or malicious modifications when a user clicks a button or opens a document. To execute these methods via a document button, they must be called through a trusted function.

Trusted functions must be defined within a folder-level JavaScript (.js) file on the local machine rather than embedded within the PDF itself.

1
Create the JavaScript File

Open a plain text editor (like Notepad) and create a new script using app.trustedFunction to wrap your insertPages command.

2
Locate the JavaScripts Folder

Navigate to the JavaScripts folder in your Acrobat installation directory, typically found at C:\Program Files\Adobe\Acrobat DC\Acrobat\JavaScripts.

3
Save the Script

Save your newly created text file with a .js extension directly into the JavaScripts folder.

4
Update the PDF Button

Open your PDF in Acrobat, edit the properties of your button, and update its JavaScript action to call your custom trusted function instead of calling insertPages() directly.

5
Restart Acrobat

Close and reopen Adobe Acrobat so the application can load your folder-level JavaScript into its memory.

Create a Trusted Function in a Folder-Level JavaScript File
Distribution Limitation: Because the trusted function resides on your local machine, the PDF button will only work for users who also have this specific .js file installed in their local Acrobat JavaScripts folder.
Free Microsoft Office alternative

Manage PDF Pages Visually with WPS Office

If configuring Acrobat JavaScript and setting up trusted local functions is too complex for your workflow, WPS Office provides an intuitive alternative. You can easily insert, extract, and rearrange PDF pages through a user-friendly interface without writing any scripts.

  1. 1. Open WPS PDF: Launch WPS Office and open the PDF document you want to modify.
  2. 2. Access Page Tools: Select the 'Page' tab from the top navigation ribbon to view page management options.
  3. 3. Insert Pages Easily: Click 'Insert Pages' to visually add blank pages or import pages from another file with a few simple clicks.
Insert and manipulate PDF pages visually without needing complex JavaScript configurations.High compatibility with Adobe PDF formats and Microsoft Office documents.Lightweight suite that sidesteps complicated document-level security troubleshooting.Includes a robust suite of PDF, Word, Excel, and PowerPoint tools in a single app.
microsoft office alternative - wps office

Frequently Asked Questions

Why does insertPages() work in the Acrobat console but not via a button?

The Acrobat JavaScript console operates in a privileged context, meaning it bypasses most security restrictions. However, PDF buttons operate in a restricted document-level context to prevent malicious automated actions, causing security-settings errors for commands like insertPages().

Can I embed a trusted function directly inside the PDF document?

No, Adobe Acrobat security requires trusted functions to be placed in a folder-level JavaScript file stored safely on the user's local hard drive. Embedding them directly within the PDF would defeat the software's security protocols.

Will my PDF button work if I email the file to someone else?

No. If your button's functionality relies on a folder-level trusted function, the recipient must also have that exact .js file manually installed in their local Acrobat application folder for the button to work.

Where is the Acrobat JavaScripts folder located on Windows?

By default, it is usually located at C:\Program Files\Adobe\Acrobat DC\Acrobat\JavaScripts. The exact path may vary slightly depending on whether you are using Acrobat Pro, Standard, or Reader, and whether it is a 32-bit or 64-bit installation.