Package com.itextpdf.text.pdf
Class PdfEncodings
java.lang.Object
com.itextpdf.text.pdf.PdfEncodings
Supports fast encodings for winansi and PDFDocEncoding.
Supports conversions from CJK encodings to CID.
Supports custom encodings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static HashMap
<String, ExtraEncoding> (package private) static final IntHashtable
(package private) static final char[]
(package private) static final IntHashtable
(package private) static final char[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addExtraEncoding
(String name, ExtraEncoding enc) Adds an extra encoding.static final byte[]
convertToBytes
(char char1, String encoding) Converts aString
to a byte array according to the font's encoding.static final byte[]
convertToBytes
(String text, String encoding) Converts aString
to a byte array according to the font's encoding.static final String
convertToString
(byte[] bytes, String encoding) Converts a byte array to aString
according to the some encoding.static boolean
isPdfDocEncoding
(String text) Checks istext
only has PdfDocEncoding characters.
-
Field Details
-
winansiByteToChar
static final char[] winansiByteToChar -
pdfEncodingByteToChar
static final char[] pdfEncodingByteToChar -
winansi
-
pdfEncoding
-
extraEncodings
-
-
Constructor Details
-
PdfEncodings
public PdfEncodings()
-
-
Method Details
-
convertToBytes
Converts aString
to a byte array according to the font's encoding.- Parameters:
text
- theString
to be convertedencoding
- the encoding- Returns:
- an array of
byte
representing the conversion according to the font's encoding
-
convertToBytes
Converts aString
to a byte array according to the font's encoding.- Parameters:
char1
- thechar
to be convertedencoding
- the encoding- Returns:
- an array of
byte
representing the conversion according to the font's encoding
-
convertToString
Converts a byte array to aString
according to the some encoding.- Parameters:
bytes
- the bytes to convertencoding
- the encoding- Returns:
- the converted
String
-
isPdfDocEncoding
Checks istext
only has PdfDocEncoding characters.- Parameters:
text
- theString
to test- Returns:
true
if only PdfDocEncoding characters are present
-
addExtraEncoding
Adds an extra encoding.- Parameters:
name
- the name of the encoding. The encoding recognition is case insensitiveenc
- the conversion class
-