How to Fix insertPages Security Settings Error in Adobe Acrobat
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.

- 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.
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.
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.
Open a plain text editor (like Notepad) and create a new script using app.trustedFunction to wrap your insertPages command.
Navigate to the JavaScripts folder in your Acrobat installation directory, typically found at C:\Program Files\Adobe\Acrobat DC\Acrobat\JavaScripts.
Save your newly created text file with a .js extension directly into the JavaScripts folder.
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.
Close and reopen Adobe Acrobat so the application can load your folder-level JavaScript into its memory.

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. Open WPS PDF: Launch WPS Office and open the PDF document you want to modify.
- 2. Access Page Tools: Select the 'Page' tab from the top navigation ribbon to view page management options.
- 3. Insert Pages Easily: Click 'Insert Pages' to visually add blank pages or import pages from another file with a few simple clicks.

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.




