Example usage for com.itextpdf.text Chapter Chapter

List of usage examples for com.itextpdf.text Chapter Chapter

Introduction

In this page you can find the example usage for com.itextpdf.text Chapter Chapter.

Prototype

public Chapter(int number) 

Source Link

Document

Constructs a new Chapter.

Usage

From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java

License:Open Source License

public void buildContent(PdfWriter writer, Document document, IProgressMonitor monitor) {

    monitor.beginTask("Generating Report", 100);
    try {//w w w  .ja v  a2 s . c om
        buildFirstPage(writer, document);
        document.newPage();

        monitor.worked(1);

        int chapNum = 1;
        if (genrateIntroductionChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildIntorductionChapter(c);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(9);
        if (generateSocialViewChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildSocialViewChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);
        if (generateInformationViewChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildInformationViewChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);
        if (generateAuthorisationViewChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildAuthorisationViewChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);
        if (generateSecurityRequirementsChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildSecurityRequirementsChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);
        if (generateAnalysisChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildAnalysisChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);
        if (generateAppendixAChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildAppendixAChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }

        monitor.worked(10);
        if (generateAppendixBChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildAppendixBChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);
        if (generateAppendixCChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildAppendixCChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);
        if (generateAppendixDChapter()) {
            Chapter c = new Chapter(chapNum++);
            buildAppendixDChapter(c, document);
            document.add(c);
            c.setComplete(true);
        }
        monitor.worked(10);

    } catch (DocumentException e) {
        e.printStackTrace();
    } finally {
        if (monitor != null)
            monitor.done();
    }
}

From source file:PdfCreation.PdfTableWriter.java

public Section addTable(JTable table) {
    DefaultTableModel model = (DefaultTableModel) table.getModel();
    Section ourTableSection = new Chapter(0)
            .addSection(this.newParagraph("Information Table", true, false, false));
    ourTableSection.add(new Paragraph(" "));
    PdfPTable ourTable = new PdfPTable(model.getColumnCount() + 1);
    int count = 1;

    ourTable.addCell(new Phrase("    ", FontFactory.getFont(FontFactory.HELVETICA, 8, Font.BOLD)));
    for (int i = 0; i < model.getColumnCount(); i++) {
        Phrase phrase = new Phrase(model.getColumnName(i).toString(),
                FontFactory.getFont(FontFactory.HELVETICA, 8, Font.BOLD));
        ourTable.addCell(new PdfPCell(phrase));

    }/*from  w  w  w.j  a va 2  s. c om*/

    for (int i = 0; i < model.getRowCount(); i++) {
        ourTable.addCell(new Phrase("" + count++, FontFactory.getFont(FontFactory.HELVETICA, 8)));
        for (int j = 0; j < model.getColumnCount(); j++) {
            Phrase phrase = new Phrase(model.getValueAt(i, j).toString(),
                    FontFactory.getFont(FontFactory.HELVETICA, 8));
            ourTable.addCell(phrase);
        }
    }

    ourTableSection.add(ourTable);

    return ourTableSection;
}