DynaPDF.SetPageBreakExpression
------------------------------

Sets page break expression.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [11.0](newinversion110.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.SetPageBreakExpression"; PDF; Expression ) 

**MBS**( **"DynaPDF.SetPageBreakExpression";** /\* Sets page break expression. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Expression**) /\* The expression to use. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| Expression | The expression to use. |  |

### Result

Returns OK or error.

### Description

Sets page break expression.  
We can calculate this expression when the text box is full in a function call with [DynaPDF.WriteFText](DynaPDFWriteFText.md), [DynaPDF.WriteFTextEx](DynaPDFWriteFTextEx.md), [DynaPDF.WriteStyledText](DynaPDFWriteStyledText.md) or [DynaPDF.WriteStyledTextEx](DynaPDFWriteStyledTextEx.md).  
The expression can call other functions like [DynaPDF.AppendPage](DynaPDFAppendPage.md), [DynaPDF.EndPage](DynaPDFEndPage.md) and [DynaPDF.SetTextRect](DynaPDFSetTextRect.md) of course.  
  
Please make sure your expression does not cause an endless loop or recursion.   
  
You can return in your expression what should happen with next text. Return -1 to cancel write operation.   
If you like to change alignment for next block, return 1 for left alignment, 2 for right alignment, 3 for center alignment or 4 for justify alignment.  
  
You can use [DynaPDF.GetLastTextPosY](DynaPDFGetLastTextPosY.md) to know where the text of the last text block ended.  
If you use [DynaPDF.AppendPage](DynaPDFAppendPage.md), please pass the parameter 1 to not change font.  
### Examples

Set the page break expression:

 Set Variable \[ $r ; Value: MBS ("DynaPDF.SetPageBreakExpression"; $pdf ; "Let ( \[  
  
$CurrentColumn = $CurrentColumn + 1;  
  
t = If ( $CurrentColumn &lt; $ColumnCount ;   
  
 Let ( \[   
 $PosX = $StartPosX + $CurrentColumn \* ($ColumnWidth + $Distance ) \];   
 0) ;   
  
 Let ( \[   
 $PosX = $StartPosX ;   
 $CurrentColumn = 0;   
 a = MBS ( \\"[DynaPDF.EndPage](DynaPDFEndPage.md)\\"; $pdf );   
 a = MBS ( \\"[DynaPDF.AppendPage](DynaPDFAppendPage.md)\\"; $pdf ; 1)\];   
 0)   
);  
  
a = MBS ( \\"[DynaPDF.SetTextRect](DynaPDFSetTextRect.md)\\"; $pdf ; $PosX ; $PosY ; $ColumnWidth ; $ColumnHeight )  
\]; 0 )") \]  
### See also

- [DynaPDF.AllowPageBreak](DynaPDFAllowPageBreak.md)
- [DynaPDF.AppendPage](DynaPDFAppendPage.md)
- [DynaPDF.EndPage](DynaPDFEndPage.md)
- [DynaPDF.GetPageBreakExpression](DynaPDFGetPageBreakExpression.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetTextRect](DynaPDFSetTextRect.md)
- [DynaPDF.WriteFText](DynaPDFWriteFText.md)
- [DynaPDF.WriteFTextEx](DynaPDFWriteFTextEx.md)
- [DynaPDF.WriteStyledText](DynaPDFWriteStyledText.md)
- [DynaPDF.WriteStyledTextEx](DynaPDFWriteStyledTextEx.md)

### Release notes

- **Version 11.0**
    - Added [DynaPDF.SetPageBreakExpression](https://www.mbsplugins.eu/DynaPDFSetPageBreakExpression.shtml) and [DynaPDF.GetPageBreakExpression](https://www.mbsplugins.eu/DynaPDFGetPageBreakExpression.shtml) to allow custom page breaks and multi column output.

### Example Databases

- [DynaPDF/Book Creation](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Book%20Creation.shtml#3ScriptAnchor_)
- [DynaPDF/Multi Column Output](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Multi%20Column%20Output.shtml#1ScriptAnchor_)
- [DynaPDF/Page Layouting](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Page%20Layouting.shtml#2ScriptAnchor_)

### Blog Entries

- [Use complex text rendering with DynaPDF in FileMaker](https://www.mbsplugins.de/archive/2025-06-25/Use_complex_text_rendering_wit/monkeybreadsoftware_blog_filemaker)
- [Page Layouting in DynaPDF](https://www.mbsplugins.de/archive/2024-04-05/Page_Layouting_in_DynaPDF/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 11.0](https://www.mbsplugins.de/archive/2021-01-26/New_in_MBS_FileMaker_Plugin_11/monkeybreadsoftware_blog_filemaker)
- [Neues MBS FileMaker Plugin 11.0](https://www.mbsplugins.de/archive/2021-01-19/Neues_MBS_FileMaker_Plugin_110/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 11.0 - More than 6400 Functions In One Plugin](https://www.mbsplugins.de/archive/2021-01-19/MBS_FileMaker_Plugin_110_-_Mor/monkeybreadsoftware_blog_filemaker)
- [Multi Column Output for PDFs with FileMaker](https://www.mbsplugins.de/archive/2020-12-22/Multi_Column_Output_for_PDFs_w/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.6pr3](https://www.mbsplugins.de/archive/2020-12-21/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 15th December 2020 , last changed 27th March 2026

  
[DynaPDF.SetPageBBox](DynaPDFSetPageBBox.md) - [DynaPDF.SetPageCoords](DynaPDFSetPageCoords.md)

[HTML Version](DynaPDFSetPageBreakExpression.shtml)