public class PdfEncodings extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CP1250
A possible encoding.
|
static String |
CP1252
A possible encoding.
|
static String |
CP1253
A possible encoding.
|
static String |
CP1257
A possible encoding.
|
static String |
IDENTITY_H
The Unicode encoding with horizontal writing.
|
static String |
IDENTITY_V
The Unicode encoding with vertical writing.
|
static String |
MACROMAN
A possible encoding.
|
static String |
PDF_DOC_ENCODING
This is the default encoding to be used for converting Strings into bytes and vice versa.
|
static String |
SYMBOL
A possible encoding.
|
static String |
UNICODE_BIG
This is the encoding to be used to output text in Unicode.
|
static String |
UNICODE_BIG_UNMARKED
This is the encoding to be used to output text for Identity-H/V CMaps.
|
static String |
UTF8 |
static String |
WINANSI
A possible encoding.
|
static String |
ZAPFDINGBATS
A possible encoding.
|
Constructor and Description |
---|
PdfEncodings() |
Modifier and Type | Method and Description |
---|---|
static void |
addExtraEncoding(String name, IExtraEncoding enc)
Adds an extra encoding.
|
static byte[] |
convertToBytes(char ch, String encoding)
Converts a String to a byte array according to the font's encoding.
|
static byte[] |
convertToBytes(String text, String encoding)
Converts a String to a byte array according to the font's encoding.
|
static String |
convertToString(byte[] bytes, String encoding)
Converts a byte array to a String according to the some encoding.
|
static boolean |
isPdfDocEncoding(String text)
Checks is text only has PDF_DOC_ENCODING characters.
|
public static final String IDENTITY_H
public static final String IDENTITY_V
public static final String CP1250
public static final String CP1252
public static final String CP1253
public static final String CP1257
public static final String WINANSI
public static final String MACROMAN
public static final String SYMBOL
public static final String ZAPFDINGBATS
public static final String UNICODE_BIG
public static final String UNICODE_BIG_UNMARKED
public static final String PDF_DOC_ENCODING
public static final String UTF8
public static byte[] convertToBytes(String text, String encoding)
String
to a byte
array according to the font's encoding.
encoding
- the encoding
text
- the String
to be converted
byte
representing the conversion according to the font's encoding
public static byte[] convertToBytes(char ch, String encoding)
String
to a byte
array according to the font's encoding.
encoding
- the encoding
ch
- the char
to be converted
byte
representing the conversion according to the font's encoding
public static String convertToString(byte[] bytes, String encoding)
byte
array to a String
according to the some encoding.
bytes
- the bytes to convert
encoding
- the encoding
String
public static boolean isPdfDocEncoding(String text)
text
only has PDF_DOC_ENCODING characters.
text
- the String
to test
true
if only PDF_DOC_ENCODING characters are present
public static void addExtraEncoding(String name, IExtraEncoding enc)
name
- the name of the encoding. The encoding recognition is case insensitive
enc
- the conversion class
Copyright © 1998–2023 iText Group NV. All rights reserved.