DynaPDF.FreeTextAnnot
---------------------

Creates a Free Text annotation.

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

MBS( "DynaPDF.FreeTextAnnot"; PDF; PosX; PosY; Width; Height; Author; Text; Textalign ) 

**MBS**( **"DynaPDF.FreeTextAnnot";** /\* Creates a Free Text annotation. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$PosX**; /\* x-coordinatee.g. 100 \*/   
**$PosY**; /\* y-coordinatee.g. 100 \*/   
**$Width**; /\* Stamp widthe.g. 100 \*/   
**$Height**; /\* Stamp heighte.g. 100 \*/   
**$Author**; /\* The author name. Can be empty.e.g. "Christian Schmitz" \*/   
**$Text**; /\* The visible text of the annotation.e.g. "Hello World" \*/   
**$Textalign**) /\* The text alignment. Can be Left, Center, Right or Justify.e.g. "Justify" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| PosX | x-coordinate | 100 |
| PosY | y-coordinate | 100 |
| Width | Stamp width | 100 |
| Height | Stamp height | 100 |
| Author | The author name. Can be empty. | "Christian Schmitz" |
| Text | The visible text of the annotation. | "Hello World" |
| Textalign | The text alignment. Can be Left, Center, Right or Justify. | "Justify" |

### Result

Returns annotation handle or error.

### Description

Creates a Free Text annotation.   
The text of a Free Text annotation appears directly on screen such as normal text of a page. However, Free Text annotations are used to add comments. Comments can be excluded from printing if necessary (see [DynaPDF.SetAnnotFlags](DynaPDFSetAnnotFlags.md) for further information) and the contents of a Free Text annotation can be edited in Adobe's Acrobat.  
The text of the annotation is printed into the bounding box by applying a formatting algorithm so that the text appears left aligned, right aligned, centered, or justified. Justified text is not directly supported by Adobe's Acrobat. However, the annotation appears correctly on screen but the alignment is set to left aligned text if the text will be changed in Acrobat.  
The border of the annotation is drawn by using the current line width, stroke color and line dash pattern. If the annotation should appear without a border set the line width to zero beforehand.  
The border appears completely inside the bounding box of the annotation. This must be considered because normal vector graphics such as rectangles, ellipses and so on are measured without the line width. For instance, the real width of a rectangle is the width plus the line width.  
A Free Text annotation requires a font. If no font is set beforehand Helvetica is used. The largest font size that can be used in Free Text annotations is 12 units. If the active font uses a larger font size then it will be changed to 12 units.  
Text positioning issues:  
Acrobat 7 or higher use a very unusual way to place text into a Free Text annotation. While the baseline of text is very well defined in practically all typo graphics systems, Acrobat uses a dynamic position depending on the height of the largest character in the first line. The baseline is placed at the annotation's height - border width - cap height as long as the first line contains no character with an accent (e.g. Ä, Ö, Ü, À, È, Ê, Ñ). Because the cap height is not large enough for accented characters Acrobat adjusts the position of the first line if necessary. So, the text position depends on the contents of the first text line.  
DynaPDF places the text at the annotation's height - border width - font size. This is makes it possible to change the text of a Free Text annotation without changing its position. However, if the annotation will be edited with Adobe's Acrobat the text position will slightly change. If the text position is important then it is mostly better to use text fields instead (see [DynaPDF.CreateTextField](DynaPDFCreateTextField.md)).  
See also [FreeTextAnnot](https://www.monkeybreadsoftware.com/DynaPDF-Manual/FreeTextAnnot.shtml) function in DynaPDF manual.

### See also

- [DynaPDF.ConvToFreeTextCallout](DynaPDFConvToFreeTextCallout.md)
- [DynaPDF.CreateTextField](DynaPDFCreateTextField.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetAnnotBorderStyle](DynaPDFSetAnnotBorderStyle.md)
- [DynaPDF.SetAnnotBorderWidth](DynaPDFSetAnnotBorderWidth.md)
- [DynaPDF.SetAnnotColor](DynaPDFSetAnnotColor.md)
- [DynaPDF.SetAnnotFlags](DynaPDFSetAnnotFlags.md)
- [DynaPDF.TextAnnot](DynaPDFTextAnnot.md)

### Blog Entries

- [Unlocking the Power of PDFs in FileMaker with DynaPDF and the MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2024-09-16/Unlocking_the_Power_of_PDFs_in/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 28th November 2014 , last changed 30th November 2014

  
[DynaPDF.FontInfo](DynaPDFFontInfo.md) - [DynaPDF.GeneratePreview](DynaPDFGeneratePreview.md)

[HTML Version](DynaPDFFreeTextAnnot.shtml)