How to Switch PDF Text Fields Between Horizontal and Vertical
Question details
The user wants to know how to enable end users filling out an interactive PDF form to toggle the text direction of a specific field between horizontal and vertical orientations.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form where respondents may need to input text in varying orientations, requiring a dynamic toggle feature.
- Observed behavior
- The goal is to provide an interactive button within the PDF form that rotates the text field upon being clicked, successfully changing the input direction.
Ensure you have access to a PDF editor with advanced form creation and JavaScript capabilities, such as Adobe Acrobat Pro, and verify the exact name of the text field you wish to manipulate.
Create a Toggle Button Using JavaScript
Use a form button programmed with a JavaScript action to dynamically change the rotation property of the target text field.
Interactive PDF forms can utilize JavaScript to modify field properties on the fly. By linking a script to a custom button, you can evaluate the current rotation of a text field and toggle it between 0 degrees (horizontal) and 90 or 270 degrees (vertical).
Open your PDF document in Adobe Acrobat Pro and select the 'Prepare Form' tool from the right-hand pane to begin editing form fields.
Insert a new 'Text Field' where you want the user to type. Right-click the field, choose 'Properties', and note the exact Name of the field (e.g., 'TextField1').
Select the 'Button' tool from the Prepare Form toolbar and place it near the text field. Label it appropriately, such as 'Rotate Text'.
Right-click the new button and go to 'Properties'. Navigate to the 'Actions' tab, select 'Mouse Up' as the trigger, choose 'Run a JavaScript' from the action dropdown, and click 'Add'.
In the JavaScript editor, write a script to fetch the text field by its name, check its 'rotation' property, and change it. For example, if rotation is 0, set it to 90; otherwise, set it back to 0. Click 'OK' to save.
Exit 'Prepare Form' mode and click your new button. Type text into the field to verify that the orientation successfully toggles between horizontal and vertical.

Easily Edit and Manage PDF Forms with WPS Office
WPS Office provides a comprehensive suite of PDF tools, allowing you to easily fill, edit, and manage interactive PDF forms. Whether you need to adjust text orientation, add new fields, or convert documents, WPS PDF handles it effortlessly.
- 1. Open Your PDF in WPS: Launch WPS Office and open your interactive PDF form document.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to interact with fillable text fields and buttons.
- 3. Edit Text Properties: If you need to permanently change the text layout, switch to the 'Edit' tab to modify text orientation or properties directly.
- 4. Save and Export: Once your form adjustments are complete, click 'Save' or export the document to share it with your users.

Frequently Asked Questions
Does JavaScript in PDF forms work on mobile devices?
Most mobile PDF readers and built-in browser viewers have limited or no support for JavaScript. It is highly recommended to rely on standard, static orientation settings if your audience predominantly uses mobile devices.
Can I set a PDF text field to be vertical by default?
Yes. In most professional PDF form editors, you can open the properties of the text field, navigate to the 'Appearance' or 'General' tab, and manually set the text rotation to 90, 180, or 270 degrees.
Why isn't my JavaScript button rotating the text field?
This usually occurs if the field name referenced in your script does not exactly match the actual name of the text field. Check for typos and case sensitivity. Additionally, ensure that JavaScript execution is enabled in your PDF reader's security preferences.




