// build font descriptor
PDFontDescriptor fd = buildFontDescriptor(metrics);
// read the pfb
byte[] pfbBytes = IOUtils.toByteArray(pfbStream);
PfbParser pfbParser = new PfbParser(new ByteArrayInputStream(pfbBytes));
type1 = Type1Font.createWithPFB(new ByteArrayInputStream(pfbBytes));
PDStream fontStream = new PDStream(doc, pfbParser.getInputStream(), false);
fontStream.getStream().setInt("Length", pfbParser.size());
for (int i = 0; i < pfbParser.getLengths().length; i++)
{
fontStream.getStream().setInt("Length" + (i + 1), pfbParser.getLengths()[i]);
}
fontStream.addCompression();
fd.setFontFile(fontStream);
// set the values