Dudo
Dudo

Reputation: 4169

Rails app - How do you add new lines in pdftk?

I'm filling out a pdf in a rails app with the pdf-forms gem and I have the need for a dynamically created multiline string. (foo, bar, and baz are methods of some sort below)

"#{foo}" + '\r' +
"#{bar if baz}" +
"#{'\r' if baz}"

I've tried \n and \r, and the combination of the two. That gives me the little square, and no carriage return.

I've tried \u2028, U+2028, ^p, and probably others... I'm at a loss. Any ideas?

Upvotes: 1

Views: 689

Answers (1)

Dudo
Dudo

Reputation: 4169

The issue was in Adobe Acrobat. When saving the document, you need to have the options in the field set to:

  • multi-line
  • allow rich text formatting

With those options, \r gave me a proper carriage return.

Within Adobe Acrobat Pro:

 1. Tools
 2. Prepare Form
 3. Create/Double click on text area
 4. Options
 5. Select "Multi-Line"

Upvotes: 2

Related Questions