PDF Editing Issues

Create an Acrobat JavaScript Button to Move PDF Form Fields

Nimra MalikNimra Malik Nov 25, 2026 868 views

Question details

Create an UP button that uses JavaScript to move a signature or form field in a PDF.

Create an Acrobat JavaScript Button to Move PDF Form Fields
Product
Adobe Acrobat
Device & OS
not provided
Scenario
The user wants a PDF form button to reposition a specified field when clicked.
Observed behavior
Clicking the button should move the target field upward by a defined distance.
Before you start

Open the PDF in a version of Acrobat that supports form editing and document JavaScript. Check the exact name of the field you want to move in Prepare a form, and make sure JavaScript is enabled for testing.

Solution 1Recommended

Call a Document-Level Function from the UP Button

Use this approach to move a named form or signature field upward whenever the button is clicked.

The function changes the field rectangle's vertical coordinates. The example moves the field by 10 PDF points per click; change that value to adjust the distance.

1
Add the movement function

In Acrobat, open All tools > Use JavaScript > Document JavaScripts. In some versions, use Tools > JavaScript > Document JavaScripts. Add a script named MoveUp and enter: function moveFieldUp(fieldName) { var f = this.getField(fieldName); if (!f) { app.alert('Field not found: ' + fieldName); return; } var r = f.rect; r[1] += 10; r[3] += 10; f.rect = r; }

2
Create or select the button

Open All tools > Prepare a form, add a Button field if needed, and name it UP. Open the button's Properties and set its visible label to UP.

3
Add the button action

In the button Properties dialog, open Actions. Select Mouse Up as the trigger and Run a JavaScript as the action, then click Add. Enter moveFieldUp('Signature1');, replacing Signature1 with the exact name of your target field.

4
Test the movement

Close the Properties dialog, exit form editing or use Preview, and click UP. Confirm that the intended field moves upward, then save the PDF.

Call a Document-Level Function from the UP Button
Check the PDF viewer and field state: The button requires a PDF viewer that supports and allows Acrobat JavaScript. Test before signing: a signed or otherwise restricted PDF may prevent field changes.
Free Microsoft Office alternative

Work with PDFs and Office Documents in WPS Office

WPS Office is a free, lightweight alternative for everyday document and PDF work. Its familiar interface and Microsoft Office format support make it easy to bring existing files into your workflow. Use Acrobat for the JavaScript-driven field movement described above.

Open and work with PDF documents alongside office filesCompatible with Microsoft Word, Excel, and PowerPoint formatsFamiliar interface for a smooth transition from Microsoft OfficeFree, lightweight tools for everyday productivity
microsoft office alternative - wps office

Frequently Asked Questions

How do I find the name of the field I want to move?

In Acrobat, open Prepare a form and select the field. Check its name in the field list or in the field's Properties, then use that exact name in the button's JavaScript.

Can the same function move different fields?

Yes. Call moveFieldUp with a different field name for each button, such as moveFieldUp('Text1'); or moveFieldUp('Signature1');.

How can I change how far the field moves?

In Document JavaScripts, edit the MoveUp function and change both instances of 10 to the same desired distance in PDF points. Positive values move the field upward.

Why doesn't the button work in my PDF viewer?

The viewer may not support Acrobat JavaScript, or JavaScript may be disabled. Test the saved PDF in Acrobat with JavaScript enabled, and check that the target field name matches exactly.