ImageGear for C and C++ on Linux v19.10 - Updated
IG_PDF_translate_to_pdf
API Reference Guide > PDF Component API Reference > PDF Component Functions Reference > IG_PDF_translate_to_pdf

Translates a string from host encoding to PDFDocEncoding or Unicode.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_PDF_translate_to_pdf(
        AT_PDF_BOOL bUseUnicode,
        LPCSTR szInHostStr,
        LONG nInHostStrSize,
        LPSTR szOutPDFStr,
        LONG nOutPDFStrSize,
        LPLONG lpnOutPDFStrBytes
);

Arguments:

Name Type Description
bUseUnicode AT_PDF_BOOL If TRUE, translate the string to Unicode; otherwise use PDFDocEncoding.
szInHostStr LPCSTR Pointer to the string to translate (may point to the same memory as szOutPDFStr, allowing strings to translate in place).
nInHostStrSize LONG Number of bytes in szOutPDFStr.
szOutPDFStr LPSTR Pointer to the translated string (may point to the same memory as szInHostStr).
nOutPDFStrSize LONG The length of the szOutPDFStr buffer, in bytes.
lpnOutPDFStrBytes LPLONG Number of bytes in the translated string szOutPDFStr.

Return Value:

Error count

Supported Raster Image Formats:

This function does not process image pixels.

Remarks:

This function is useful when using text that must be in PDFDocEncoding or Unicode, such as text in a text annotation, bookmark, or article title.

A character that cannot be converted to the destination encoding is replaced with a space.

For example, it converts \n to a space character (\r is present in PDFDocEncoding and is left unchanged).

Host encoding is a platform-dependent encoding for the host machine. For non-UNIX Roman systems, it is MacRomanEncoding in Mac OS and WinAnsiEncoding in Windows. In UNIX (except HP-UX) Roman systems, it is ISO8859-1 (ISO Latin-1); for HP-UX, it is HP-ROMAN8. See Appendix D in the PDF Reference for descriptions of MacRomanEncoding, WinAnsiEncoding, and PDFDocEncoding.

For non-Roman systems, the host encoding may be a variety of encodings, which are defined by a CMap (character map). See Section 5.6.4 in the PDF Reference for a list of predefined CMaps.

Use IG_PDF_get_host_encoding to determine if a system's host encoding is Roman or not.