如何解决在IText 7中添加新字体
我正在尝试在Itext7中设置新字体,但它不会反映在PDF中。
private static final String BrushED_SCRIPT = "src/main/resources/fonts/LucyTheCatRegular-Bg9x.ttf";
private PdfFont brushedScriptFont = null;
public PDFService() {
try {
this.brushedScriptFont = PdfFontFactory.createFont(BrushED_SCRIPT);
} catch (Exception e) {
throw new RuntimeException();
}
}
private Cell getAddressCell(String text,TextAlignment alignment) throws IOException {
Cell cell = new Cell().add(new Paragraph(text).setFont(brushedScriptFont));
cell.setPadding(0);
//cell.setFont(this.brushedScriptFont);
cell.setTextAlignment(alignment);
cell.setBorder(Border.NO_BORDER);
cell.setFontSize(14);
return cell;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。