PdfTextData.GetCharacterCodes Method

Gets character codes for the chunk of text data.

Namespace:  BitMiracle.Docotic.Pdf
Assembly:  BitMiracle.Docotic.Pdf (in BitMiracle.Docotic.Pdf.dll)

Syntax

C#
public byte[] GetCharacterCodes()
VB
Public Function GetCharacterCodes As Byte()

Return Value

Type: Byte[]
Character codes for the chunk of text data ordered according to the visual order.

Remarks

Character codes represent raw PDF string that is used to draw the text. They strictly depend on a font and font's encoding in PDF document. An attempt to use character codes with another font can lead to unpredictable result.

Character codes are always ordered according to the visual order. I.e., from left to right for horizontal writing mode.

First byte in the array of character codes always contain system info. Make sure to use only one system byte if you concatenate codes from multiple chunks. Like that:

byte[] firstCodes = first.GetCharacterCodes();
byte[] secondCodes = second.GetCharacterCodes();
byte[] concatenated = new byte[firstCodes.Length + secondCodes.Length - 1];
Array.Copy(firstCodes, 0, concatenated, 0, firstCodes.Length);
Array.Copy(secondCodes, 1, concatenated, firstCodes.Length, secondCodes.Length - 1);

Use DrawString(Byte[]) method to draw text using character codes. Make sure to set Font property to Font property of this text data.

Use GetCharacters() method to get character codes for individual glyphs.

See Also