PDF Automation Station

PDF Automation Station

Using Special Characters

Organize data with line breaks and tabs by using special characters in text strings.

David Dagley's avatar
David Dagley
May 21, 2025
∙ Paid
1
Share
black and white checkered textile
Photo by Tomas Martinez on Unsplash

When writing JavaScript for Acrobat programs and forms there are special characters that can be inserted into text strings to separate and organize parts of the string. These characters must be "escaped" in the string, that is, preceded by a backslash. The backslash lets the JavaScript engine know that the next character is a special character. In this post I will be examining three of these special characters.

  1. \r - A backslash followed by a lower case r signifies a carriage return (a new line).

  2. \n - A backslash followed by a lower case n signifies a new line. It is very similar to the carriage return but does not act exactly the same.

  3. \t - A backslash followed by a lower case t signifies a tab.

Try running these scripts in the console:

//Script 1
"The quick brown fox\rjumped over the lazy dogs."

//Script 2
"The quick brown fox\njumped over the lazy dogs."

//Script 3
"The\tquick\tbrown\tfox"

//Script 4
"The\tquick\tbrown\nfox\tjumped\tover\rthe\tlazy\tdogs."

Get the course above, and a suite of automation tools for FREE with a Professional subscription.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 David Dagley
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture