DynaPDF Manual - Page 813

Previous Page 812   Index   Next Page 814

Function Reference
Page 813 of 818
Escape Sequences
In situations where an alignement or command tag should be output as plain text it is possible to
precede the tag with an additional backslash. This marks the string as plain text and the function
does not interpret it as command or alignment tag. The first backslash is treated as escape character
and will be removed.
Example:
\\
= \\
\\ce#
= \ce#
\\\le#
= \\le#
\\LI [...] = \\LI [...] // No valid tag -> always processed as text
\\LI[...]
= \LI[...]
The function compares the first four characters of command tags which accept parameters . If the
sequence matches a command tag an additional backslash is required if the string should be output
as text.
It is also possible to fully disable alignment and command tags with the flag taPlainText that can be
passed to the parameter Align. Combine the flag with the wished alignment constant with a binary
or operator, e.g. (TTextAlign)(taRight | taPlainText). This can be useful when it is known that the
incomming text cannot contain alignment or command tags. Line breaks and so on are still
processed as usual but all kinds of alignment and command tags will be interpreted as plain text.
How to create multi-column text?
WriteFText() supports a callback function which can be used to create various formattings. The
callback function is required to print text into multiple columns.
The Visual Basic and VB .Net interfaces use events instead of callback functions. However, the usage
is identical but the event must be manually connected with the function ConnectPageBreakEvent()
so that the event can be raised.
A good example to demonstrate the usage of the callback function is the output of multi-column
text. In the following example we have a text file that contains the text that should be printed. The
text that we use in this example is not of interest, it must only be large enough so that WriteFText()
generates an OnPageBreak event. Note that it is also possible to create this event manually with the
command tag \np#.
Example (C++):
First, we define a structure which contains all variables we need to calculate the output rectangle.
We pass this structure to the SetOnPageBreakProc() function so that we don't need any global data.
struct TOutRect
{
void* iPDF;
// Active PDF instance
double PosX;
// X-coordinate of first output rectangle
double PosY;
// Y-coordinate of first output rectangle
double Width;
// Original width of the output rectangle
double Height;
// Original height of the output rectangle
 

Previous topic: Special characters

Next topic: WriteFTextEx, WriteText


Start Chat