How to Set a Maximum Auto-Shrinking Font Size in a PDF Form
Question details
The user needs a PDF form text field to maintain a maximum font size of 6 points, which then automatically shrinks when the entered text exceeds the single-line width.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Designing an interactive PDF form with strict text-fitting requirements for a specific field.
- Observed behavior
- A custom JavaScript solution temporarily enforces the font size limit, but the field reverts to default automatic sizing when the text is deleted and replaced.
Ensure you have access to a professional PDF editor capable of modifying form field properties and executing JavaScript, and remember to test your forms in a dedicated desktop PDF viewer rather than a web browser.
Configure Form Field Properties and Event Scripts
Adjust the physical height of the form field, disable multiline input, and trigger your font-sizing JavaScript on the correct events to ensure consistent behavior.
Relying solely on Focus and Blur events often causes scripts to fail when text is actively being edited or deleted. Shifting the script execution to Validate, Format, or Keystroke events ensures the font size is recalculated accurately in real time.
Right-click the target text field, select 'Properties', and navigate to the 'Options' tab. Ensure the 'Multi-line' checkbox is cleared so the text is forced onto a single line.
Resize the height of the text field to approximately 0.32 to 0.33 cm. This physical restriction naturally forces the default 'Auto' size behavior to start near 6 points.
Open the field properties and go to the 'Calculate', 'Validate', or 'Format' tab to add your custom JavaScript. Write a script that checks the field value and reapplies the 6-point maximum size whenever the content changes.
Save the document and open it in standard desktop PDF software like Acrobat Reader or WPS Office. Verify that the font size shrinks when the box fills up and remains capped at 6 points when text is deleted.

Create and Manage Interactive PDF Forms with WPS Office
WPS Office provides an advanced and intuitive PDF editor that allows you to easily design, customize, and fill out interactive PDF forms without relying entirely on complex JavaScript.
- 1. Open your PDF: Launch WPS Office and open your target PDF document.
- 2. Access the Form tools: Navigate to the 'Form' tab located in the top ribbon menu to reveal the interactive form creation tools.
- 3. Insert a text field: Click on 'Text Field' and draw the field directly onto your document where user input is required.
- 4. Customize properties: Double-click the new text field to open its properties panel, where you can easily adjust text alignment, default font size, and visual appearance.

Frequently Asked Questions
Why does my PDF form field font size change when I delete text?
If your JavaScript is bound to Focus and Blur events, it only runs when you click into or click out of the field. Moving the script to the Format, Validate, or Keystroke event ensures the font size is dynamically recalculated immediately as text is deleted or typed.
Does the auto-shrink text feature work when viewing PDFs in web browsers?
Not reliably. Built-in PDF viewers in browsers like Chrome, Safari, or Edge often strip out or ignore advanced form JavaScript. It is highly recommended that users download the PDF and open it in a dedicated program like WPS Office or Adobe Acrobat to ensure scripts execute properly.
How do I make text auto-shrink without using any JavaScript?
You can achieve basic auto-shrinking by opening the text field properties, navigating to the 'Appearance' tab, and setting the Font Size to 'Auto'. The text will shrink to fit once the field is full. However, setting a strict maximum limit (like capping it at exactly 6 points) usually requires adjusting the physical height of the box to ~0.33 cm so the 'Auto' size naturally caps out at that dimension.




