public StreamFont(byte[] contents,
int[] lengths,
int compressionLevel) throws DocumentException {
BuiltinFonts14.put(COURIER, PdfName.COURIER);
BuiltinFonts14.put(COURIER_BOLD, PdfName.COURIER_BOLD);
BuiltinFonts14.put(COURIER_BOLDOBLIQUE, PdfName.COURIER_BOLDOBLIQUE);
BuiltinFonts14.put(COURIER_OBLIQUE, PdfName.COURIER_OBLIQUE);
BuiltinFonts14.put(HELVETICA, PdfName.HELVETICA);
BuiltinFonts14.put(HELVETICA_BOLD, PdfName.HELVETICA_BOLD);
BuiltinFonts14.put(HELVETICA_BOLDOBLIQUE, PdfName.HELVETICA_BOLDOBLIQUE);
BuiltinFonts14.put(HELVETICA_OBLIQUE, PdfName.HELVETICA_OBLIQUE);
BuiltinFonts14.put(SYMBOL, PdfName.SYMBOL);
BuiltinFonts14.put(TIMES_ROMAN, PdfName.TIMES_ROMAN);
BuiltinFonts14.put(TIMES_BOLD, PdfName.TIMES_BOLD);
BuiltinFonts14.put(TIMES_BOLDITALIC, PdfName.TIMES_BOLDITALIC);
BuiltinFonts14.put(TIMES_ITALIC, PdfName.TIMES_ITALIC);
BuiltinFonts14.put(ZAPFDINGBATS, PdfName.ZAPFDINGBATS);
try {
bytes = contents;
put(PdfName.LENGTH, new PdfNumber(bytes.length));
for (int k = 0; k < lengths.length; ++k) {
put(new PdfName("Length" + (k + 1)), new PdfNumber(lengths[k]));
}
flateCompress(compressionLevel);
}
catch (Exception e) {
throw new DocumentException(e);
}
}
Generates the PDF stream with the Type1 and Truetype fonts returning
a PdfStream. Parameters:
contents - the content of the stream
lengths - an array of int that describes the several lengths of each part of the font
compressionLevel - the compression level of the Stream
Throws:
DocumentException - error in the stream compression
- since:
2.1.3 - (replaces the constructor without param compressionLevel)
|