Xojo Conferences

DynaPDF Manual - Page 748

Previous Page 747   Index   Next Page 749

Function Reference
Page 748 of 770
TranslateString (obsolete)
SI32 fntTranslateString(
struct TPDFStack* Stack, // Structure which holds the current text stack
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 GetPageText(). This function
is marked as obsolete because the member Kerning of the structure TPDFStack contains already the
converted Unicode string. See GetPageText() for further information.
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 stack.TextLen * 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 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.

Previous topic: TranslateRawCode (Font API)

Next topic: TranslateString2 (Font API)