DynaPDF Manual - Page 348

Previous Page 347   Index   Next Page 349

Function Reference
Page 348 of 818
typedef enum
{
taLeft,
taCenter,
taRight,
taJustify
}TTextAlign;
This function 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 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 typographics 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 CreateTextField()).
Remarks:
This function is implemented in an Ansi and Unicode compatible variant.
 

Previous topic: FreeImageObjEx, FreePDF, FreeTextAnnot

Next topic: FreeUniBuf, Get3DAnnotStream, GetActionCount


Start Chat