new GfrFileOutputStream("com.lowagie.examples.fonts.styles.FontStylePropagation.pdf"));
// step 3: we open the document
document.open();
// step 4:
LwgPhrase myPhrase = new LwgPhrase("Hello 1! ", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.BOLD));
myPhrase.add(new LwgPhrase("some other font ", new LwgFont(LwgFont.HELVETICA, 8)));
myPhrase.add(new LwgPhrase("This is the end of the sentence.\n", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.ITALIC)));
document.add(myPhrase);
myPhrase = new LwgPhrase(12);
myPhrase.add(new LwgPhrase("Hello 2! ", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.BOLD)));
myPhrase.add(new LwgPhrase("This is the end of the sentence.\n", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.ITALIC)));
document.add(myPhrase);
myPhrase = new LwgPhrase("Hello 3! ", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, LwgFont.BOLD));
myPhrase.add(new LwgPhrase("some other font ", FontFactory.getFont(FontFactory.HELVETICA, 8)));
myPhrase.add(new LwgPhrase("This is the end of the sentence.\n", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, LwgFont.ITALIC)));
document.add(myPhrase);
Paragraph myParagraph = new Paragraph("Hello 1bis! ", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.BOLD));
myParagraph.add(new Paragraph("This is the end of the sentence.", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.ITALIC)));
document.add(myParagraph);
myParagraph = new Paragraph(12);
myParagraph.add(new Paragraph("Hello 3bis! ", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.BOLD)));
myParagraph.add(new Paragraph("This is the end of the sentence.", new LwgFont(LwgFont.TIMES_ROMAN, 8, LwgFont.ITALIC)));
document.add(myParagraph);
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());