Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.FreeTextAnnot

Creates a Free Text annotation.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 5.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.FreeTextAnnot"; PDF; PosX; PosY; Width; Height; Author; Text; Textalign )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $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 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).

See also FreeTextAnnot function in DynaPDF manual.

See also

This function checks for a license.

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


DynaPDF.FontInfo - DynaPDF.GeneratePreview