在书中我看到了例子:
BaseFont bf = BaseFont.createFont("KozMinPro-Regular", "Identity-V", BaseFont.NOT_EMBEDDED);
Font font = new Font(bf, 20);
VerticalText vt = new VerticalText(writer.getDirectContent()); vt.setVerticalLayout(390, 570, 540, 12, 30);
font = new Font(bf, 20);
vt.addText(new Phrase(convertCIDs("a"), font));
vt.go();
public String convertCIDs(String text) {
char cid[] = text.toCharArray();
for (int k = 0; k < cid.length; ++k) {
char c = cid[k];
if (c == '\n')
cid[k] = '\uff00';
else
cid[k] = (char) (c - ' ' + 8720);
}
return new String(cid);
}
Run Code Online (Sandbox Code Playgroud)
当我更改为:
BaseFont bf …Run Code Online (Sandbox Code Playgroud) itext ×1