DynaPDF Manual - Page 359
Previous Page 358 Index Next Page 360
Function Reference
Page 359 of 839
FreeTextAnnot
Syntax:
SI32 pdfFreeTextAnnot(
const PPDF* IPDF,
// Instance pointer
double PosX,
// X-Coordinate of the bounding rectangle
double PosY,
// Y-Coordinate of the bounding rectangle
double Width,
// Width of the bounding rectangle
double Height,
// Height of the bounding rectangle
const char* Author, // Author of the annotation (can be NULL)
const char* AText,
// The visible text of the annotation
TTextAlign Align)
// The text alignment see below
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.
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.
Previous topic: FreeImageObj, FreeImageObjEx, FreePDF
Next topic: FreeUniBuf, Get3DAnnotStream