DynaPDF Manual - Page 816

Previous Page 815   Index   Next Page 817

Function Reference
Page 816 of 839
The parameter Flags was defined for future use. No flags are defined at this time, the parameter is
The output string buffer is automatically allocated in VB .Net and C#. The parameter OutText
should be initialized with null or Nothing when using these programming languages.
This function should not be used to convert strings of CID fonts. To process strings of CID fonts use
the function TranslateRawCode().
To improve processing speed the function does not check whether the parameters are valid.
In C/C++ and Delphi the output string buffer is not null-terminated and the function does not use
the exception handling of DynaPDF. In VB .Net and C# the function returns a native .Net string. No
error message is returned on failure. However, the only possible error is out of memory.
Return values:
If the function succeeds the return value is the number of Unicode characters copied into the buffer.
If the function fails the return value is zero.
TranslateString2 (Font API)
SI32 fntTranslateString2(
const void* IFont, // Pointer of the active font
const BYTE* Text,
// Raw text to be converted
UI32 Len,
// Text length in bytes
UI16* OutText,
// Output Unicode buffer
UI32 Size,
// Length of the Unicode buffer in characters
UI32 Flags);
// No flags are defined at this time
The function converts a binary string to Unicode that was returned by ParseContent() or
GetPageText(). The converted string is copied to the parameter OutText. The output buffer must be
allocated by the caller. Note that the string buffer is a Unicode string in UTF-16 format. The
parameter Size represents the length of the buffer in characters, it must be long enough to hold the
entire string.
The output buffer should be at least Len * 16 / 10 + 32 characters long. However, to avoid
unnecessary memory allocation calls it is usually best to use a static conversion buffer with a length
of about 2048 or 4096 characters. Longer strings can normally not occur in well formatted PDF files
because a huge paper format would be required to display such a long string. The maximum
allowed string length in PDF is 32767 characters.

Previous topic: TranslateString (obsolete)

Next topic: Triangle