0

这是我正在使用的代码...

 Paragraph p1 = new Paragraph("Hi! I am generating my first PDF using DroidText");
 Font paraFont =  new Font(Font.COURIER,20.0f,Color.GREEN);
 p1.setAlignment(Paragraph.ALIGN_CENTER);
 p1.setFont(font1);
 doc.add(p1);
4

2 回答 2

3

简单的解决方案:

private static Font fontbold16 = FontFactory.getFont("COURIER", 16, Font.BOLDITALIC, Color.GRAY);
Paragraph p1 = new Paragraph("Hi! I am generating my first PDF using DroidText");
p1.setAlignment(Paragraph.ALIGN_CENTER);
doc.add(p1, fontbold16);

注意:您可以将“ COURIER”更改为更改Time New RomanArial..etc

于 2015-08-22T09:47:16.283 回答
2

这帮助我解决了我的问题..

Font paraFont =  new Font(Font.COURIER,20.0f,Color.GREEN);
Paragraph p1 = new Paragraph("Hi! I am generating my first PDF using DroidText",paraFont);
doc.add(p1);
于 2014-04-29T06:51:59.437 回答