Package com.itextpdf.text.pdf
Class PdfEncodings
- java.lang.Object
-
- com.itextpdf.text.pdf.PdfEncodings
-
public class PdfEncodings extends Object
Supports fast encodings for winansi and PDFDocEncoding. Supports conversions from CJK encodings to CID. Supports custom encodings.- Author:
- Paulo Soares
-
-
Constructor Summary
Constructors Constructor Description PdfEncodings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addExtraEncoding(String name, ExtraEncoding enc)
Adds an extra encoding.static byte[]
convertToBytes(char char1, String encoding)
Converts aString
to a byte array according to the font's encoding.static byte[]
convertToBytes(String text, String encoding)
Converts aString
to a byte array according to the font's encoding.static 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.
-
-
-
Method Detail
-
convertToBytes
public static final byte[] convertToBytes(String text, 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, 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 String convertToString(byte[] bytes, 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(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(String name, ExtraEncoding enc)
Adds an extra encoding.- Parameters:
name
- the name of the encoding. The encoding recognition is case insensitiveenc
- the conversion class
-
-