1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| document.add(new Chunk("China")); document.add(new Chunk(" ")); Font font = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD, BaseColor.WHITE); Chunk id = new Chunk("chinese", font); id.setBackground(BaseColor.BLACK, 1f, 0.5f, 1f, 1.5f); id.setTextRise(6); document.add(id); document.add(Chunk.NEWLINE); document.add(new Chunk("Japan")); document.add(new Chunk(" ")); Font font2 = new Font(Font.FontFamily.HELVETICA, 6, Font.BOLD, BaseColor.WHITE); Chunk id2 = new Chunk("japanese", font2); id2.setBackground(BaseColor.BLACK, 1f, 0.5f, 1f, 1.5f); id2.setTextRise(6); id2.setUnderline(0.2f, -2f); document.add(id2); document.add(Chunk.NEWLINE);
document.newPage(); document.add(new Phrase("Phrase page")); Phrase director = new Phrase(); Chunk name = new Chunk("China"); name.setUnderline(0.2f, -2f); director.add(name); director.add(new Chunk(",")); director.add(new Chunk(" ")); director.add(new Chunk("chinese")); director.setLeading(24); document.add(director); Phrase director2 = new Phrase(); Chunk name2 = new Chunk("Japan"); name2.setUnderline(0.2f, -2f); director2.add(name2); director2.add(new Chunk(",")); director2.add(new Chunk(" ")); director2.add(new Chunk("japanese")); director2.setLeading(24); document.add(director2);
document.newPage(); document.add(new Paragraph("Paragraph page")); Paragraph info = new Paragraph(); info.add(new Chunk("China ")); info.add(new Chunk("chinese")); info.add(Chunk.NEWLINE); info.add(new Phrase("Japan ")); info.add(new Phrase("japanese")); document.add(info);
document.newPage(); List list = new List(List.ORDERED); for (int i = 0; i < 10; i++) { ListItem item = new ListItem(String.format("%s: %d movies", "country" + (i + 1), (i + 1) * 100), new Font( Font.FontFamily.HELVETICA, 6, Font.BOLD, BaseColor.WHITE)); List movielist = new List(List.ORDERED, List.ALPHABETICAL); movielist.setLowercase(List.LOWERCASE); for (int j = 0; j < 5; j++) { ListItem movieitem = new ListItem("Title" + (j + 1)); List directorlist = new List(List.UNORDERED); for (int k = 0; k < 3; k++) { directorlist.add(String.format("%s, %s", "Name1" + (k + 1), "Name2" + (k + 1))); } movieitem.add(directorlist); movielist.add(movieitem); } item.add(movielist); list.add(item); } document.add(list);
|