DynaPDF Manual - Page 820

Previous Page 819   Index   Next Page 821

Function Reference
Page 820 of 839
The input string must be defined in the CPU's byte ordering (little-endian on a little-endian machine
and big-endian on a big-endian machine), the output string is also returned in the CPU's byte
ordering.
The return value is a pointer to the original conversion buffer; it must not be freed or changed. The
function can be called multiple times without causing a memory leak. However, if the conversion
buffers are no longer needed they can be released with FreeUniBuf() (this will free all four buffers).
The buffers are automatically released when CloseFile() or FreePDF() is called.
The function requires no open PDF file; it can be used at any time. Invalid character sequences are
skipped by the algorithm, they do not break conversion.
Return values:
If the function succeeds the return value is a pointer to the converted UTF-16 Unicode string. If the
function fails the return value is NULL. The only possible error during conversion is out of memory.
UTF32ToUTF16Ex
Syntax:
UI16* pdfUTF32ToUTF16Ex(
const PPDF* IPDF,
// Instance pointer
const UI32* Source, // UTF-32 Unicode string
UI32 ADDR Len)
// String length in characters
The function converts a UTF-32 Unicode string to UTF-16. UTF-32 is the default Unicode format on
Linux and UNIX operating systems. The input string must be defined in the CPU's byte ordering
(little-endian on a little-endian machine and big-endian on a big-endian machine), the output string
is also returned in the CPU's byte ordering.
The used conversion algorithm is binary save. The parameter Len holds the string length in
characters before and after conversion. The new string length can be longer then original one
because surrogates are expressed as two character sequence in UTF-16, but as one character in
UTF-32.
The return value is a pointer to the original conversion buffer; it must not be freed or changed. The
function can be called multiple times without causing a memory leak. However, if the conversion
buffer is no longer needed it can be released with the function FreeUniBuf(). The buffer is
automatically released when CloseFile() or FreePDF() is called.
The function requires no open PDF file; it can be used at any time. Invalid character sequences are
skipped by the algorithm, they do not break conversion.
Return values:
If the function succeeds the return value is a pointer to the converted UTF-32 Unicode string. If the
function fails the return value is NULL. The only possible error during conversion is out of memory.
 

Previous topic: UTF32ToUTF16

Next topic: WatermarkAnnot, WebLink