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