Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set bold and italic to a word in itext pdf

Tags:

fonts

itext

How to set bold and italic to a word in itext pdf.

for example:

"Hello World"

in one sentence

please advice me.

like image 459
Vijay Leo Avatar asked Mar 22 '14 04:03

Vijay Leo


1 Answers

Please check this one:

Font font1 = new Font(Font.TIMES_ROMAN, 10, Font.BOLD);
Chunk hello = new Chunk("Hello", font1);
Chunk world = new Chunk("World",
new Font(Font.TIMES_ROMAN, 10, Font.ITALIC));
document.add(hello);
document.add(world);
like image 92
arin1405 Avatar answered Sep 19 '22 00:09

arin1405