DynaPDF Manual - Page 836
Previous Page 835 Index Next Page 837
Function Reference
Page 836 of 860
the character to Unicode; this value must be used to increment the text pointer and to decrement the
remaining text length.
The resulting Unicode character or sequence is stored in the parameter OutText, as well as the
corresponding output text length and the character width.
The parameter Decoded is set to true if the source character could be sucsessfully converted to
Unicode. If Decode is false the output string and character width contain no meaningful values.
The function can only fail when processing strings of CID fonts, e.g. if the font depends on an
external CMap that could not be loaded, or if the font uses a damaged CMap. The search path(s) to
external CMaps should always be set before extracting text from PDF files with SetCMapDir().
Passing an invalid or undefined code sequence to the function does not result in an error. In this
case the notdef character is added to the output string (this is usually 0 or 0xFFFD if the font
contains a ToUnicode CMap).
Notice:
To improve processing speed the function does not check whether the parameters are valid.
Remarks:
This function was designed to convert raw strings on a per character basis to Unicode which were
returned by ParseContent() or GetPageText(). The parameters CharSpacing, WordSpacing, and
TextScale must be taken from the current graphics state or from the structure TPDFStack.
Return values:
The return value of this function is always greater or equal to one. Check the parameter Decoded to
determine whether the function succeed.
TranslateString (obsolete)
Syntax:
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.
Previous topic: TranslateCoords, TranslateRawCode (Font API)
Next topic: TranslateString2 (Font API)