PDF Editing Issues

How to Apply Strikethrough Formatting to Generated Acrobat Form Text

Algirdas JasaitisAlgirdas Jasaitis Nov 10, 2026 868 views

Question details

The user needs to dynamically apply strikethrough formatting to specific words in an Acrobat PDF form field populated via JavaScript.

How to Apply Strikethrough Formatting to Generated Acrobat Form Text
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF form uses JavaScript to populate a text field automatically based on another field's input (e.g., containing 'Y'), and certain sections of the generated text require special formatting.
Observed behavior
The user wants to format specific generated text with a strikethrough line instead of outputting standard plain text strings.
Before you start

Ensure you have access to the form editing tools in your PDF software and that your target text field is properly configured to accept rich text formatting.

Solution 1Recommended

Use JavaScript Rich Text Spans to Apply Strikethrough

Enable rich text formatting in the target field's properties, then use an array of rich-text spans within your JavaScript calculation script to selectively apply the strikethrough format.

Standard text assignment using event.value only supports plain text. To apply text styles like strikethrough to specific words in Adobe Acrobat, you must use the event.richValue property and define each section of text as an independent formatting span.

1
Enable Rich Text Formatting

Right-click your target text field and select 'Properties'. Navigate to the 'Options' tab and check the box for 'Allow Rich Text Formatting'.

2
Open the JavaScript Editor

Go to the 'Calculate' tab in the field properties and select 'Custom calculation script'. Click 'Edit' to open the JavaScript editor.

3
Define the Text Spans

Create an array of objects to act as spans. Assign plain text to the first span (e.g., spans[0].text = 'SPECIFIC '). Create a second span for the strikethrough text (e.g., spans[1].text = 'TEXT') and set spans[1].strikethrough = true.

4
Assign to event.richValue

Assign the completed array to the field's event.richValue (e.g., event.richValue = spans;). If the condition is not met, ensure you clear the field by setting event.value = '';

Use JavaScript Rich Text Spans to Apply Strikethrough
Rich Text Spans Support Additional Formatting: You can use this exact same span array method to apply other font characteristics, such as font color, weight, and style, by adding properties like spans[x].textColor or spans[x].fontWeight.
Effortless PDF Editing Tools

Edit and Format PDF Text Easily with WPS PDF

While custom JavaScript provides dynamic form filling, you can often achieve your document goals much faster using intuitive direct editing tools. WPS Office offers powerful PDF features to edit text, apply strikethroughs natively, and manage interactive forms without writing a single line of code.

  1. 1. Open Your PDF: Launch WPS Office and open your interactive PDF document or form.
  2. 2. Access Edit Mode: Navigate to the 'Edit' tab on the top ribbon and select 'Edit Text' to make the document's content selectable.
  3. 3. Apply Strikethrough Visually: Highlight the specific text you wish to strike out, then click the 'Strikethrough' icon in the floating formatting toolbar.
  4. 4. Save Your Form: Click 'Save' to ensure your newly formatted text is permanently applied to the PDF file.
Directly edit PDF text and apply strikethrough, bold, and italic formatting visuallyHighly compatible with standard interactive PDF forms and Adobe Acrobat formatsUser-friendly interface requiring no programming knowledge for basic form fillingLightweight suite that handles PDFs alongside word documents and spreadsheets
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my JavaScript strikethrough formatting showing up in the PDF form?

If your script executes but the text remains unformatted, verify that 'Allow Rich Text Formatting' is enabled in the field's Properties under the Options tab. Without this setting checked, event.richValue scripts will be ignored.

Can I apply bold or italic formatting using the same rich text span method?

Yes. Within your JavaScript span array, you can define bold text by adding spans[x].fontWeight = 800, or apply italics by using spans[x].fontStyle = 'italic' alongside the text property.

Does the standard event.value property support any text formatting?

No, event.value only outputs plain string text. To display formatted text variations (such as strikethroughs, different colors, or fonts) dynamically within the same field, you must rely on the event.richValue property.