Table of Contents

Class PdfEncodings

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

Supports fast encodings for winansi and PDFDocEncoding. @author Paulo Soares (psoares@consiste.pt)

public static class PdfEncodings
Inheritance
PdfEncodings
Inherited Members

Fields

CrlfCidNewline

Assumes that '\n' and '\r\n' are the newline sequences. It may not work for all CJK encodings. To be used with LoadCmap().

public static byte[][] CrlfCidNewline

Field Value

byte[][]

Methods

AddExtraEncoding(string, IExtraEncoding)

Adds an extra encoding.

public static void AddExtraEncoding(string name, IExtraEncoding enc)

Parameters

name string

the name of the encoding. The encoding recognition is case insensitive

enc IExtraEncoding

the conversion class

ClearCmap(string)

Clears the CJK cmaps from the cache. If name is the empty string then all the cache is cleared. Calling this method has no consequences other than the need to reload the cmap if needed.

public static void ClearCmap(string name)

Parameters

name string

the name of the cmap to clear or all the cmaps if the empty string

ConvertCmap(string, byte[])

Converts a byte array encoded as name to a CID string. This is needed to reach some CJK characters that don't exist in 16 bit Unicode. The font to use this result must use the encoding "Identity-H" or "Identity-V". See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.

public static string ConvertCmap(string name, byte[] seq)

Parameters

name string

the CJK encoding name

seq byte[]

the byte array to be decoded

Returns

string

the CID string

ConvertCmap(string, byte[], int, int)

Converts a byte array encoded as name to a CID string. This is needed to reach some CJK characters that don't exist in 16 bit Unicode. The font to use this result must use the encoding "Identity-H" or "Identity-V". See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.

public static string ConvertCmap(string name, byte[] seq, int start, int length)

Parameters

name string

the CJK encoding name

seq byte[]

the byte array to be decoded

start int

the start offset in the data

length int

the number of bytes to convert

Returns

string

the CID string

ConvertToBytes(char, string)

Converts a String to a byte array according to the font's encoding.

public static byte[] ConvertToBytes(char char1, string encoding)

Parameters

char1 char

the char to be converted

encoding string

the encoding

Returns

byte[]

an array of byte representing the conversion according to the font's encoding

ConvertToBytes(string, string)

Converts a string to a byte array according to the font's encoding.

public static byte[] ConvertToBytes(string text, string encoding)

Parameters

text string

the string to be converted

encoding string

Returns

byte[]

an array of byte representing the conversion according to the font's encoding

ConvertToString(byte[], string)

public static string ConvertToString(byte[] bytes, string encoding)

Parameters

bytes byte[]
encoding string

Returns

string

IsPdfDocEncoding(string)

Checks is text only has PdfDocEncoding characters.

public static bool IsPdfDocEncoding(string text)

Parameters

text string

the String to test

Returns

bool

true if only PdfDocEncoding characters are present

LoadCmap(string, byte[][])

Loads a CJK cmap to the cache with the option of associating sequences to the newline.

public static void LoadCmap(string name, byte[][] newline)

Parameters

name string

the CJK cmap name

newline byte[][]

the sequences to be replaced bi a newline in the resulting CID. See CRLF_CID_NEWLINE