PDF Editing Issues

How to Dynamically Bold and Underline Text in PDF Form Fields

Tauseeq MagsiTauseeq Magsi Oct 28, 2026 869 views

Question details

The user wants to apply mixed inline formatting, such as bolding specific words and underlining an email address, to a paragraph generated by a script inside a PDF form field.

Can You Dynamically Bold and Underline Text in PDF Form Fields?
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Automatically populating PDF form fields using scripts where certain parts of the text require distinct visual formatting.
Observed behavior
Standard PDF form fields default to plain text and do not support mixed inline formatting when populated via basic scripts.
Before you start

Ensure you have editing permissions for the PDF form, as you will need to modify the properties of the target text fields to support advanced formatting.

Solution 1Recommended

Enable Rich Text Formatting in Form Fields

Modify the form field properties to allow rich text, which is required if you want to apply mixed formatting like bold and underline dynamically.

By default, standard PDF form fields are strictly plain text. To mix bold, italic, or underlined text within the same field, you must enable the Rich Text property. Keep in mind that once enabled, any JavaScript used to populate the field must be rewritten to generate valid rich-text span objects (XML) instead of standard plain text strings.

1
Enter form editing mode

Open your PDF form in Adobe Acrobat or a capable PDF editor and switch to the 'Prepare Form' or 'Form Editing' mode.

2
Open field properties

Right-click the specific text field you want to format and select 'Properties' from the context menu.

3
Enable rich text

Navigate to the 'Options' tab in the Properties window and check the box labeled 'Allow Rich Text Formatting'.

4
Update your script

Modify your script to output rich text XML format. Instead of a simple string assignment, use the richValue property of the field to pass an array of span objects containing your specific bold and underline attributes.

Enable Rich Text Formatting in Form Fields
Scripting Limitation: Ordinary plain-text scripts will still output plain text even if the field supports rich text. You must programmatically define the formatting spans in your JavaScript.
Easy PDF Formatting Alternative

Create and Format PDFs Easily with WPS Office

Instead of struggling with complex JavaScript arrays for PDF form fields, use WPS Office to effortlessly draft your documents with perfect bold, underline, and rich text formatting. You can then seamlessly export them to high-quality PDFs in seconds.

  1. 1. Create your document: Open WPS Writer and start a new blank document, or open your existing template.
  2. 2. Apply text formatting: Type out your paragraph. Highlight specific words and use the top toolbar to easily apply bold, italics, or underline formatting.
  3. 3. Export to PDF: Click on 'Menu' in the top-left corner, select 'Export to PDF', choose your save location, and click 'Export' to generate a beautifully formatted PDF.
Easily apply bold, underline, and hyperlinks using an intuitive interface without writing complex scripts.Seamlessly convert word documents to perfectly formatted PDFs in a single click.Fully compatible with Microsoft Word (.docx) formats and standard PDF readers.Lightweight, fast, and free to use for all your daily document creation tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Can standard PDF text fields contain mixed formatting?

No, standard PDF text fields are designed exclusively for plain text. To use mixed formatting, such as bolding only specific words in a sentence, the field must have the 'Allow Rich Text Formatting' property explicitly enabled.

How do I underline an email address in a PDF script?

If the form field is plain text, you cannot selectively underline parts of it. If rich text is enabled, your script must pass a rich-text array containing a span with a text-decoration attribute applied to the email address, rather than passing a simple text string.

Can an automated email sent from a PDF script contain formatted HTML?

Native Acrobat mailto scripts only generate plain-text emails. To send HTML formatted emails featuring bold or underlined text, you cannot rely solely on the PDF; you must use a custom server-side script or an external HTML email workflow.

Is there an easier way to create formatted forms without scripting?

Yes. Designing the layout and text formatting directly in a word processor (like WPS Writer) before exporting to PDF is much simpler and more reliable than relying on JavaScript for dynamic rich text rendering.