public class PdfEncodings
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
PdfEncodings.Cp437Conversion |
private static class |
PdfEncodings.SymbolConversion |
private static class |
PdfEncodings.SymbolTTConversion |
private static class |
PdfEncodings.WingdingsConversion |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
CIDCHAR |
protected static int |
CIDNONE |
protected static int |
CIDRANGE |
(package private) static java.util.HashMap |
cmaps |
static byte[][] |
CRLF_CID_NEWLINE
Assumes that '\\n' and '\\r\\n' are the newline sequences.
|
(package private) static java.util.HashMap |
extraEncodings |
(package private) static IntHashtable |
pdfEncoding |
(package private) static char[] |
pdfEncodingByteToChar |
(package private) static IntHashtable |
winansi |
(package private) static char[] |
winansiByteToChar |
| Constructor and Description |
|---|
PdfEncodings() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addExtraEncoding(java.lang.String name,
ExtraEncoding enc)
Adds an extra encoding.
|
(package private) static void |
breakLong(long n,
int size,
byte[] seqs) |
static void |
clearCmap(java.lang.String name)
Clears the CJK cmaps from the cache.
|
static java.lang.String |
convertCmap(java.lang.String name,
byte[] seq)
Converts a
byte array encoded as name
to a CID string. |
static java.lang.String |
convertCmap(java.lang.String name,
byte[] seq,
int start,
int length)
Converts a
byte array encoded as name
to a CID string. |
static byte[] |
convertToBytes(char char1,
java.lang.String encoding)
Converts a
String to a byte array according
to the font's encoding. |
static byte[] |
convertToBytes(java.lang.String text,
java.lang.String encoding)
Converts a
String 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 a
String according
to the some encoding. |
(package private) static java.lang.String |
decodeSequence(byte[] seq,
int start,
int length,
char[][] planes) |
(package private) static void |
encodeSequence(int size,
byte[] seqs,
char cid,
java.util.ArrayList planes) |
(package private) static void |
encodeStream(java.io.InputStream in,
java.util.ArrayList planes) |
static boolean |
isPdfDocEncoding(java.lang.String text)
Checks is
text only has PdfDocEncoding characters. |
static void |
loadCmap(java.lang.String name,
byte[][] newline)
Loads a CJK cmap to the cache with the option of associating
sequences to the newline.
|
(package private) static void |
readCmap(java.lang.String name,
java.util.ArrayList planes) |
(package private) static char[][] |
readCmap(java.lang.String name,
byte[][] newline) |
protected static final int CIDNONE
protected static final int CIDRANGE
protected static final int CIDCHAR
static final char[] winansiByteToChar
static final char[] pdfEncodingByteToChar
static final IntHashtable winansi
static final IntHashtable pdfEncoding
static java.util.HashMap extraEncodings
static final java.util.HashMap cmaps
public static final byte[][] CRLF_CID_NEWLINE
public static final byte[] convertToBytes(java.lang.String text,
java.lang.String encoding)
String to a byte array according
to the font's encoding.encoding - the encodingtext - the String to be convertedbyte representing the conversion according to the font's encodingpublic static final byte[] convertToBytes(char char1,
java.lang.String encoding)
String to a byte array according
to the font's encoding.encoding - the encodingchar1 - the char to be convertedbyte representing the conversion according to the font's encodingpublic static final java.lang.String convertToString(byte[] bytes,
java.lang.String encoding)
String according
to the some encoding.bytes - the bytes to convertencoding - the encodingStringpublic static boolean isPdfDocEncoding(java.lang.String text)
text only has PdfDocEncoding characters.text - the String to testtrue if only PdfDocEncoding characters are presentpublic static void clearCmap(java.lang.String name)
name is the
empty string then all the cache is cleared. Calling this method
has no consequences other than the need to reload the cmap
if needed.name - the name of the cmap to clear or all the cmaps if the empty stringpublic static void loadCmap(java.lang.String name,
byte[][] newline)
name - the CJK cmap namenewline - the sequences to be replaced by a newline in the resulting CID. See CRLF_CID_NEWLINEpublic static java.lang.String convertCmap(java.lang.String name,
byte[] seq)
byte array encoded as name
to a CID string. This is needed to reach some CJK characters
that don't exist in 16 bit Unicode.
The font to use this result must use the encoding "Identity-H"
or "Identity-V".
See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.name - the CJK encoding nameseq - the byte array to be decodedpublic static java.lang.String convertCmap(java.lang.String name,
byte[] seq,
int start,
int length)
byte array encoded as name
to a CID string. This is needed to reach some CJK characters
that don't exist in 16 bit Unicode.
The font to use this result must use the encoding "Identity-H"
or "Identity-V".
See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.name - the CJK encoding namestart - the start offset in the datalength - the number of bytes to convertseq - the byte array to be decodedstatic java.lang.String decodeSequence(byte[] seq,
int start,
int length,
char[][] planes)
static char[][] readCmap(java.lang.String name,
byte[][] newline)
throws java.io.IOException
java.io.IOExceptionstatic void readCmap(java.lang.String name,
java.util.ArrayList planes)
throws java.io.IOException
java.io.IOExceptionstatic void encodeStream(java.io.InputStream in,
java.util.ArrayList planes)
throws java.io.IOException
java.io.IOExceptionstatic void breakLong(long n,
int size,
byte[] seqs)
static void encodeSequence(int size,
byte[] seqs,
char cid,
java.util.ArrayList planes)
public static void addExtraEncoding(java.lang.String name,
ExtraEncoding enc)
name - the name of the encoding. The encoding recognition is case insensitiveenc - the conversion class