PDF Editing Issues

Fix a PDF JavaScript Template Copy Button in Adobe Acrobat

Bushra ParveenBushra Parveen Nov 19, 2026 868 views

Question details

A user needs a PDF button to spawn a template page in Adobe Acrobat.

Fix a PDF JavaScript Template Copy Button 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.
Before you start

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.

Solution 1Recommended

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.

1
Inspect the button action

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.

2
Check the JavaScript console

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.

3
Verify the template

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.

4
Recreate the template if needed

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.

Check the Template Name and JavaScript Errors in Acrobat Pro
Files saved in Foxit: If the PDF was modified or saved in Foxit, validate the template and button action in Acrobat Pro before retesting. Availability of Page Templates controls can vary by Acrobat version.
Free Microsoft Office alternative

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.

Open and work with PDF documents alongside other office filesCompatible with Microsoft Office formats including DOCX, XLSX, and PPTXFamiliar interface for a straightforward transitionFree and lightweight for everyday document tasks
microsoft office alternative - wps office

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.