DynaPDF.SetTextRect
-------------------

The function defines the output rectangle that is used to output formatted text by the function [DynaPDF.WriteFText](DynaPDFWriteFText.md).

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

MBS( "DynaPDF.SetTextRect"; PDF; PosX; PosY; Width; Height ) 

**MBS**( **"DynaPDF.SetTextRect";** /\* The function defines the output rectangle that is used to output formatted text by the function DynaPDF.WriteFText. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$PosX**; /\* X-Coordinate of output rectanglee.g. $x \*/   
**$PosY**; /\* Y-Coordinate of output rectanglee.g. $y \*/   
**$Width**; /\* Width of output rectanglee.g. $w \*/   
**$Height**) /\* Height of output rectangle or -1.e.g. $h \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| PosX | X-Coordinate of output rectangle | $x |
| PosY | Y-Coordinate of output rectangle | $y |
| Width | Width of output rectangle | $w |
| Height | Height of output rectangle or -1. | $h |

### Result

Returns OK or error message.

### Description

The function defines the output rectangle that is used to output formatted text by the function [DynaPDF.WriteFText](DynaPDFWriteFText.md).   
See also [SetTextRect](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetTextRect.shtml) function in DynaPDF manual.

### Examples

Write some text in a rectangle area:

 #Add page with some text   
Set Variable \[$r ; Value:MBS ("[DynaPDF.AppendPage](DynaPDFAppendPage.md)"; $pdf )\]  
Set Variable \[$r ; Value:MBS ("DynaPDF.SetTextRect"; $pdf ; 100; 100; 400; 200)\]  
Set Variable \[$r ; Value:MBS ("[DynaPDF.SetFont](DynaPDFSetFont.md)"; $pdf ; "Times"; 1; 40; 1; "cp1252")\]  
Set Variable \[$r ; Value:MBS ("[DynaPDF.WriteFText](DynaPDFWriteFText.md)"; $pdf ; "Center"; "Just a test PDF.")\]  
Set Variable \[$r ; Value:MBS ("[DynaPDF.EndPage](DynaPDFEndPage.md)"; $pdf )\]  
### See also

- [DynaPDF.GetFTextHeight](DynaPDFGetFTextHeight.md)
- [DynaPDF.GetFTextHeightEx](DynaPDFGetFTextHeightEx.md)
- [DynaPDF.GetTextBBox](DynaPDFGetTextBBox.md)
- [DynaPDF.GetTextRise](DynaPDFGetTextRise.md)
- [DynaPDF.GetTextWidth](DynaPDFGetTextWidth.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.RGB](DynaPDFRGB.md)
- [DynaPDF.SetFont](DynaPDFSetFont.md)
- [DynaPDF.SetPageBreakExpression](DynaPDFSetPageBreakExpression.md)
- [DynaPDF.WriteFText](DynaPDFWriteFText.md)

### Example Databases

- [DynaPDF/Add Weblinks](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Add%20Weblinks.shtml#3ScriptAnchor_)
- [DynaPDF/Book Creation](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Book%20Creation.shtml#3ScriptAnchor_)
- [DynaPDF/Create Text as PDFA](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Create%20Text%20as%20PDFA.shtml#3ScriptAnchor_)
- [DynaPDF/Live Styled Text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Live%20Styled%20Text.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_)
- [DynaPDF/Place Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Place%20Picture.shtml#1ScriptAnchor_)
- [DynaPDF/Styled Text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Styled%20Text.shtml#2ScriptAnchor_)
- [DynaPDF/Watermark pages](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Watermark%20pages.shtml#2ScriptAnchor_)
- [DynaPDF/ZUGFeRD and Facture-X/ZUGFeRD Invoice](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/ZUGFeRD%20and%20Facture-X/ZUGFeRD%20Invoice.shtml#3ScriptAnchor_)

### Blog Entries

- [Create PDF/UA with DynaPDF in FileMaker](https://www.mbsplugins.de/archive/2026-05-27/Create_PDFUA_with_DynaPDF_in_F/monkeybreadsoftware_blog_filemaker)
- [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)
- [Multi Column Output for PDFs with FileMaker](https://www.mbsplugins.de/archive/2020-12-22/Multi_Column_Output_for_PDFs_w/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 27th May 2017

  
[DynaPDF.SetTextFieldValueEx](DynaPDFSetTextFieldValueEx.md) - [DynaPDF.SetTextRise](DynaPDFSetTextRise.md)

[HTML Version](DynaPDFSetTextRect.shtml)