Fix a PDF JavaScript Template Copy Button in Adobe Acrobat
Question details
A user needs a PDF button to spawn a template page in Adobe Acrobat.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF button uses JavaScript to copy a template page.
- Observed behavior
- The copy function works in Foxit but not when the PDF is opened in Adobe Acrobat.
Open the PDF in Acrobat Pro and check that you can access its button properties and JavaScript console. Only change security settings for a PDF from a source you trust.
Check the Template Name and JavaScript Errors in Acrobat Pro
Use Acrobat Pro to identify whether the button script or its referenced template is causing the failure.
Open the PDF in Acrobat Pro, choose Prepare a form, and open the copy button's Properties. Under Actions, select the JavaScript action and choose Edit to check the template name and spawning code.
Open the JavaScript console in Acrobat Pro, click the copy button, and review any reported errors. Use the error message and line number to identify a missing template or a script failure.
In Acrobat Pro, look for Page Templates under Organize Pages > More, or use the JavaScript console to check whether this.getTemplate("tpltBrandID") returns a template. The name must match the button script exactly, including capitalization.
If the template is missing or invalid, use Acrobat Pro's Page Templates controls to create or redefine it with the name used by the script. Save the PDF, reopen it in Acrobat, and test the button again.

Review Acrobat JavaScript and Document Security Settings
Check permissions when the console reports that JavaScript or a spawning operation is blocked.
Use WPS Office for Everyday PDF and Office Work
WPS Office is a free, lightweight Office alternative with a familiar interface for working with PDFs and Office files. Its format compatibility makes it easy to move everyday documents between applications; it does not fix Acrobat's JavaScript or template settings.

Frequently Asked Questions
Where can I see errors from the PDF button script?
Open the JavaScript console in Acrobat Pro, then click the button. Review the error message and line number to help locate the failing part of the script.
How do I check whether the PDF template has the right name?
Compare the name in the button's Properties > Actions JavaScript with the template listed in Acrobat Pro's Page Templates controls. You can also check this.getTemplate("tpltBrandID") in the JavaScript console.
Why does the button work in Foxit but not Acrobat?
The applications can handle PDF templates, JavaScript, and security restrictions differently. Check the template and console in Acrobat Pro, especially if the file was saved in Foxit.
Will the button also work in Acrobat Reader?
Not necessarily. Test the PDF in Reader separately: template spawning may depend on the product's capabilities, document rights, and security settings.
Should I disable Acrobat security to make the button work?
No. Check the console and any security warning first. If the PDF is from a trusted source, use the relevant trust prompt or review Preferences > Security (Enhanced) rather than broadly disabling protections.




