更新时间:2022-06-24 08:29:25
以下是使用Windings字体的方法:
Here is how you can do it using Windings font:
BaseFont base = BaseFont.createFont("C:\\Winodws\\fonts\\wingding_0.ttf", BaseFont.IDENTITY_H, false);
Font font = new Font(base, 16f, Font.BOLD);
char checked='\u00FE';
char unchecked='\u00A8';
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
// Here is how to add a checked checkbox
document.add(new Paragraph(String.valueOf(checked),font));
Here is an unchecked checkbox
document.add(new Paragraph(String.valueOf(unchecked),font));
document.close();
如果你想添加任何额外的字符,只需引用Windings字符集: http://www.alanwood.net/demos/wingdings.html
If you want to add any extra character, just reference the Windings character set: http://www.alanwood.net/demos/wingdings.html