您好我已经使用索引来移动特定页面使用chunk如下第一个图像如何将css添加到更好的第二个图像中,或者是否有很好的方法来使用itext移动特定页面进行这种索引设计。
Document document = new Document(PageSize.A4.rotate());
// step 2
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Test.pdf"));
// step 3
document.open();
Chunk chunk11 = new Chunk("1");
chunk11.setLocalGoto("1");
chunk11.setLocalDestination("1");
Chunk chunk12 = new Chunk("2");
chunk12.setLocalGoto("2");
Chunk chunk13 = new Chunk("3");
chunk13.setLocalGoto("3");
Chunk chunk14 = new Chunk("4");
chunk14.setLocalGoto("4");
document.add(new Paragraph(chunk11));
document.add(new Paragraph(chunk12));
document.add(new Paragraph(chunk13));
document.add(new Paragraph(chunk14));
PdfPTable table = new PdfPTable(2);
table.addCell("Subject ");
table.addCell(" Obtain marks ");
result = Student_resultby_parent_daoimp.Details();
ExaminationDTO examinationDTO = result.get(0);
table.addCell("Kannada");
table.addCell(Integer.toString(90));
table.addCell("English");
table.addCell(Integer.toString(85));
table.addCell("Hindi");
table.addCell(Integer.toString(95));
table.addCell("Mathematics");
table.addCell(Integer.toString(85));
table.addCell("Science");
table.addCell(Integer.toString(90));
table.addCell("SocialStudies");
table.addCell(Integer.toString(60));
table.addCell("Total marks");
table.addCell(Integer.toString(550));
document.add(table);
Chapter chapter = new Chapter(0);
document.add(chapter);
/*
* XMLWorkerHelper.getInstance().parseXHtml(writer, document, new
* FileInputStream("index.jsp"));
*/
Chunk chunk21 = new Chunk("1");
chunk21.setLocalGoto("1");
Chunk chunk22 = new Chunk("2");
chunk22.setLocalDestination("2");
chunk22.setLocalGoto("2");
Chunk chunk23 = new Chunk("3");
chunk23.setLocalGoto("3");
Chunk chunk24 = new Chunk("4");
chunk24.setLocalGoto("4");
document.add(new Paragraph(chunk21));
document.add(new Paragraph(chunk22));
document.add(new Paragraph(chunk23));
document.add(new Paragraph(chunk24));
table.addCell("Subject ");
table.addCell(" Obtain marks ");
result = Student_resultby_parent_daoimp.Details();
examinationDTO = result.get(1);
PdfPTable table1 = new PdfPTable(2);
table1.addCell("Subject ");
table1.addCell(" Obtain marks ");
table1.addCell("Kannada");
table1.addCell(Integer.toString(10));
table1.addCell("English");
table1.addCell(Integer.toString(20));
table1.addCell("Hindi");
table1.addCell(Integer.toString(30));
table1.addCell("Mathematics");
table1.addCell(Integer.toString(40));
table1.addCell("Science");
table1.addCell(Integer.toString(50));
table1.addCell("SocialStudies");
table1.addCell(Integer.toString(60));
table1.addCell("Total marks");
table1.addCell(Integer.toString(110));
document.add(table1);
document.close();