DynaPDF Manual - Page 816
Previous Page 815 Index Next Page 817
Page 816 of 821
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.
\\LI [...] = \\LI [...] // No valid tag -> always processed as text
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
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#.
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.
// Active PDF instance
// X-coordinate of first output rectangle
// Y-coordinate of first output rectangle
// Original width of the output rectangle
// Original height of the output rectangle
Previous topic: Special characters
Next topic: WriteFTextEx, WriteText