0

Here is Code which I am using...

 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);
Harmlezz
  • 7,972
  • 27
  • 35
Naveed Ali
  • 2,609
  • 1
  • 22
  • 37

2 Answers2

3

Easy Solution:

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);

Note: you can change "COURIER" to change Time New Roman, Arial..etc

2

this helped me to resolve my problem..

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);
Naveed Ali
  • 2,609
  • 1
  • 22
  • 37