在itext pdf中将粗体和斜体设置为单词

Vij*_*Leo 6 fonts itext

如何在itext pdf中为单词设置粗体和斜体.

例如:

" 你好 世界 "

用一句话

请指教.

ari*_*405 7

请检查一下:

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);
Run Code Online (Sandbox Code Playgroud)