Skip to main content

Text Controls - Line & Page Break Guide

Text control characters provide precise control over document layout and structure within PDF4me templates. These special control characters enable you to manage line breaks, page breaks, column structures, paragraph formatting, and other layout elements programmatically within your generated documents.


Available Control Characters

PDF4me templates support the following control characters for document structure management:

Column Break

Inserts a column break, moving content to the next column in multi-column layouts.

<<[ControlChar.ColumnBreak]>>

Use Case: Multi-column newsletters, brochures, or documents with columnar layouts.

Example:

Column 1 Content...
<<[ControlChar.ColumnBreak]>>
Column 2 Content...

Line Break

Inserts a line break within the same paragraph, moving to the next line without starting a new paragraph.

<<[ControlChar.LineBreak]>>

Use Case: Addresses, poetry, or multi-line content within a single paragraph.

Example:

Customer Name: <<[customerName]>><<[ControlChar.LineBreak]>>
Address Line 1: <<[address1]>><<[ControlChar.LineBreak]>>
Address Line 2: <<[address2]>><<[ControlChar.LineBreak]>>
City, State ZIP: <<[city]>>, <<[state]>> <<[zipCode]>>

Output:

Customer Name: John Smith
Address Line 1: 123 Main Street
Address Line 2: Suite 100
City, State ZIP: New York, NY 10001

Line Feed

Inserts a line feed character, similar to pressing Enter in a text editor.

<<[ControlChar.LineFeed]>>

Use Case: Creating vertical spacing or separating lines of text.


Non-Breaking Space

Inserts a space that prevents line breaks, keeping words together on the same line.

<<[ControlChar.NonBreakingSpace]>>

Use Case: Keeping units with numbers (e.g., "100 km"), names together, or preventing unwanted line breaks.

Example:

Distance: <<[distance]>><<[ControlChar.NonBreakingSpace]>>kilometers

Ensures "kilometers" stays on the same line as the number.


Page Break

Inserts a page break, forcing content to start on a new page.

<<[ControlChar.PageBreak]>>

Use Case: Separating major sections, ensuring content starts on new pages, or controlling pagination.

Example:

Section 1 Content...
<<[ControlChar.PageBreak]>>
Section 2 Content...

Paragraph Break

Inserts a paragraph break, ending the current paragraph and starting a new one.

<<[ControlChar.ParagraphBreak]>>

Use Case: Creating distinct paragraphs, adding vertical spacing, or structuring text.

Example:

First paragraph text here.<<[ControlChar.ParagraphBreak]>>
Second paragraph text here.<<[ControlChar.ParagraphBreak]>>
Third paragraph text here.

Section Break

Inserts a section break, creating a new document section with independent formatting.

<<[ControlChar.SectionBreak]>>

Use Case: Different headers/footers per section, orientation changes (portrait to landscape), or independent page numbering.


Tab

Inserts a tab character for alignment purposes.

<<[ControlChar.Tab]>>

Use Case: Aligning text, creating columns without tables, or indentation.

Example:

Name:<<[ControlChar.Tab]>><<[customerName]>>
Email:<<[ControlChar.Tab]>><<[email]>>
Phone:<<[ControlChar.Tab]>><<[phone]>>

Practical Applications

Application 1: Multi-Section Document

Template:

Chapter 1: Introduction
<<[chapter1Content]>>
<<[ControlChar.PageBreak]>>

Chapter 2: Analysis
<<[chapter2Content]>>
<<[ControlChar.PageBreak]>>

Chapter 3: Conclusion
<<[chapter3Content]>>

Application 2: Formatted Address Block

Template:

<<[companyName]:caps>><<[ControlChar.LineBreak]>>
<<[address1]>><<[ControlChar.LineBreak]>>
<<if [address2 != null]>><<[address2]>><<[ControlChar.LineBreak]>><</if>>
<<[city]>>, <<[state]>><<[ControlChar.NonBreakingSpace]>><<[zipCode]>><<[ControlChar.LineBreak]>>
<<[country]>>

Application 3: Tabular Data Without Tables

Template:

Item<<[ControlChar.Tab]>>Quantity<<[ControlChar.Tab]>>Price
<<foreach [item in items]>>
<<[item.name]>><<[ControlChar.Tab]>><<[item.qty]>><<[ControlChar.Tab]>>$<<[item.price]>><<[ControlChar.LineBreak]>>
<</foreach>>

Application 4: Newsletter Layout

Template:

Article 1 Content (Column 1)...
<<[ControlChar.ColumnBreak]>>
Article 2 Content (Column 2)...
<<[ControlChar.ColumnBreak]>>
Article 3 Content (Column 3)...
<<[ControlChar.PageBreak]>>
Page 2 Content...

Combining Control Characters

Multiple control characters can be used together for complex layouts.

Example: Structured Contact List

Template:

<<foreach [contact in contacts]>>
**<<[contact.name]:caps>>**<<[ControlChar.LineBreak]>>
Position: <<[contact.position]>><<[ControlChar.LineBreak]>>
Email: <<[contact.email]>><<[ControlChar.LineBreak]>>
Phone: <<[contact.phone]>><<[ControlChar.ParagraphBreak]>>
<</foreach>>

Control Characters in Loops

Use control characters within foreach loops for dynamic formatting.

Example: Department Listing with Page Breaks

Template:

<<foreach [dept in departments]>>
**Department: <<[dept.name]>>**

<<[dept.description]>>

Employees:
<<foreach [emp in dept.employees]>>
• <<[emp.name]>> - <<[emp.role]>><<[ControlChar.LineBreak]>>
<</foreach>>

<<[ControlChar.PageBreak]>>
<</foreach>>

Each department gets its own page.


Advanced Formatting Techniques

Conditional Page Breaks

Template:

<<foreach [section in sections]>>
<<[section.title]>>
<<[section.content]>>

<<if [$index < sections.Count() - 1]>>
<<[ControlChar.PageBreak]>>
<</if>>
<</foreach>>

Adds page breaks between sections, but not after the last section.


Dynamic Spacing

Template:

<<foreach [item in items]>>
<<[item.name]>><<[ControlChar.LineBreak]>>
<<if [item.hasDetails]>>
Details: <<[item.details]>><<[ControlChar.ParagraphBreak]>>
<</if>>
<</foreach>>

Control Character Reference

Control CharacterSymbolPurposeCommon Use
ColumnBreakN/ANext columnMulti-column layouts
LineBreakNew line, same paragraphAddresses, lists
LineFeedLFLine feedText formatting
NonBreakingSpace Unbreakable spaceKeep words together
PageBreakNew pageChapter breaks
ParagraphBreakNew paragraphText separation
SectionBreak§New sectionHeaders/footers change
TabTab alignmentColumnar alignment

Best Practices

Layout Control

  1. Use appropriately - Choose the right control for your layout needs
  2. Test output - Verify control characters produce desired layout
  3. Consistent spacing - Use paragraph breaks consistently for spacing
  4. Avoid excessive breaks - Don't overuse page/section breaks

Document Structure

  1. Logical sections - Use section breaks for logical document divisions
  2. Proper pagination - Use page breaks to control where pages split
  3. Alignment - Use tabs for simple alignment needs
  4. Address formatting - Use line breaks for multi-line addresses

Template Maintenance

  1. Document usage - Comment where complex control characters are used
  2. Visual clarity - Format template for readability
  3. Test thoroughly - Verify output with different data sets
  4. Version control - Track changes to template structure

Troubleshooting

Common Issues

Issue: Unexpected page breaks in output
Solution: Check for unintended PageBreak or SectionBreak usage

Issue: Text not aligning with tabs
Solution: Verify tab stops are set in Word template

Issue: Column breaks not working
Solution: Ensure document has column layout configured

Issue: Non-breaking spaces not preventing breaks
Solution: Check for long strings that force breaks despite non-breaking spaces

Issue: Too much white space in document
Solution: Review paragraph break usage; may be excessive


Complete Example: Multi-Section Report

Template:

<<var [reportTitle = "Annual Business Report"]>>
<<var [reportYear = 2024]>>
<<var [companyName = "Tech Innovations Inc."]>>

**<<[reportTitle]>> - <<[reportYear]>>**<<[ControlChar.LineBreak]>>
<<[companyName]>><<[ControlChar.ParagraphBreak]>>

**Executive Summary**<<[ControlChar.LineBreak]>>
<<[executiveSummary]>><<[ControlChar.PageBreak]>>

**Financial Overview**<<[ControlChar.LineBreak]>>
<<foreach [quarter in quarters]>>
Q<<[$index + 1]>> <<[reportYear]>>:<<[ControlChar.LineBreak]>>
Revenue:<<[ControlChar.Tab]>>$<<[quarter.revenue]:"F2">><<[ControlChar.LineBreak]>>
Expenses:<<[ControlChar.Tab]>>$<<[quarter.expenses]:"F2">><<[ControlChar.LineBreak]>>
Profit:<<[ControlChar.Tab]>>$<<[quarter.profit]:"F2">><<[ControlChar.ParagraphBreak]>>
<</foreach>>

<<[ControlChar.SectionBreak]>>

**Department Reports**<<[ControlChar.LineBreak]>>
<<foreach [dept in departments]>>
**<<[dept.name]>>**<<[ControlChar.LineBreak]>>
<<[dept.report]>><<[ControlChar.PageBreak]>>
<</foreach>>

Layout Testing

Always generate test documents with actual data to verify that control characters produce the intended layout. Different content lengths may affect how breaks and spacing appear.

Section Breaks

Section breaks create new document sections with independent formatting. Use carefully, as they affect headers, footers, page numbering, and orientation for subsequent content.