DynaPDF Manual - Page 824

Previous Page 823   Index   Next Page 825

Function Reference
Page 824 of 839
WriteFText
Syntax:
LBOOL pdfWriteFText(
const PPDF* IPDF,
// Instance pointer
TTextAlign Align,
// Base alignment
const char* AText) // Null-terminated string to be printed
typedef enum
{
taLeft
= 0,
// Left aligned text
taCenter
= 1,
// Centered text
taRight
= 2,
// Right aligned text
taJustify
= 3,
// Justified text
taPlainText = 0x10000000 // Process the text as is
}TTextAlign;
Instead of drawing text on a line by line basis it is also possible to output text into a rectangle by
applying a formatting algorithm. The parameter Align defines the base alignment of the text to be
drawn. The alignment can be changed inside the text by using an alignment tag.
The parameter Text holds a null-terminated string which can contain optional format tags to enable
more complex formattings.
WriteFText() supports a callback function as well as several format tags which can be used to apply
more complex formattings. The following sections describe the formatting options and the usage of
the function in detail, please read these sections carefully.
Output rectangle
The output rectangle that is used by the function must be defined with the function SetTextRect(). If
no output rectangle was set beforehand the function uses a default rectangle that is defined as
follows:
If the page contains a crop box the output rectangle becomes the dimension of the crop box
with a border of 50 units (width - 100, height -100).
If no crop box is present the output rectangle becomes the dimension of the media box with
a border of 50 units (width - 100, height -100).
The bounding boxes are described in detail at SetBBox().
WirteFText() supports a callback function which is called when the output rectangle was filled with
text and if more text is available for output (see SetOnPageBreakProc() for further information). If no
callback was set, the text continues on the next page by using the same output rectangle.
To avoid page breaks set the height of the output rectangle to -1. Note that the Visual Basic and VB
.Net interfaces use events instead of callback functions. The OnPageBreak event must be manually
connected with the function ConnectPageBreakEvent().
 

Previous topic: WriteAngleText

Next topic: Text formatting, Alignment tags