How to Display Multiline Text from JSON in PDF
I'm trying to display a list of strings from a JSON array into a PDF file using the "Set PDF Form Fields" step in Decisions. The array can contain multiple lines like a list of financial transactions. When I map it to a multi-line PDF text field, all lines are shown in a single row (e.g., Text1Text2Text3
) instead of line-by-line.
Also, the PDF text field has a fixed height and can't grow dynamically. Is there a better way to display such multiline data properly in a PDF?
Comments
-
Hello!
This issue arises because PDF form fields treat plain text as a single string, and line breaks (
\n
) are often not interpreted correctly. To handle dynamic multiline content, especially when the number of lines is large or varies, the recommended approach is:✅ Solution – Use HTML to PDF Rendering:
- Loop Through JSON Array:
- Use a For Each loop on your JSON array.
- Inside the loop, concatenate each line using a
<br/>
tag for line breaks. - Use Create Data and Merge Text Editor steps to build a new
LineString
variable.
- Build Final HTML:
- Merge the
LineString
into your main HTML structure (which includes headers, footers, etc.).
- Merge the
- Generate the PDF:
- Pass the combined HTML to the HTML to PDF step. This renders the multiline content correctly with line breaks.
Example Use Case:
This method helps when dealing with a dynamic number of rows (e.g., 100+ lines), and where the PDF field cannot auto-expand.
- Loop Through JSON Array:
Howdy, Stranger!
Categories
- 4.4K All Categories
- 78 General
- 13 Training
- 209 Installation / Setup
- 1.1K Flows
- 110 Rules
- 270 Administration
- 213 Portal
- 497 General Q & A
- 709 Forms
- 345 Reports
- 3 Designer Extensions
- 48 Example Flows
- 58 CSS Examples
- 1 Diagram Tile
- 7 Javascript Controls
- 186 Pages
- 5 Process Mining
- New Features
- 186 Datastructures
- 70 Repository
- 229 Integrations
- 29 Multi-Tenant
- 27 SDK
- 81 Modules
- 59 Settings
- 25 Active Directory
- 12 Version 7
- 35 Version 8
- 143 Lunch And Learn Questions