Example usage for com.itextpdf.text Section addSection

List of usage examples for com.itextpdf.text Section addSection

Introduction

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

Prototype

public Section addSection(final String title) 

Source Link

Document

Adds a Section to this Section and returns it.

Usage

From source file:com.athena.chameleon.engine.utils.PDFWriterUtil.java

License:Apache License

/**
 * /*from   w  w w.j  a  v a 2s  .  c  o m*/
 * Section  ?
 *
 * @param chapter section?  chapter ?
 * @param text section title
 * @param sectionNo section Number
 * @return Section
 */
public static Section getSection(Section chapter, String text) {
    Section section = chapter.addSection(text);
    String title = section.getTitle().getContent();

    Chunk c;
    if (section.getDepth() >= 3) {
        c = new Chunk(text, fnSection2);
    } else {
        c = new Chunk(text, fnSection);
    }
    c.setLocalDestination(title);

    Paragraph sectionPh = new Paragraph();
    sectionPh.add(c);
    sectionPh.setSpacingBefore(8);
    sectionPh.setSpacingAfter(3);
    if (section.getDepth() >= 3)
        sectionPh.setIndentationLeft(23);

    section.setTitle(sectionPh);
    return section;
}

From source file:com.vectorprint.report.itext.DefaultElementProducer.java

License:Open Source License

/**
 * create the Section, style the title, style the section and return the styled section.
 *
 * @param title/* www  .j  av a2  s  .  c om*/
 * @param nesting
 * @param stylers
 * @return
 * @throws VectorPrintException
 * @throws InstantiationException
 * @throws IllegalAccessException
 */
@Override
public Section getIndex(String title, int nesting, List<? extends BaseStyler> stylers)
        throws VectorPrintException, InstantiationException, IllegalAccessException {
    if (nesting < 1) {
        throw new VectorPrintException("chapter numbering starts with 1, wrong number: " + nesting);
    }
    if (sections.get(nesting) == null) {
        sections.put(nesting, new ArrayList<>(10));
    }
    Section current;
    if (nesting == 1) {
        List<Section> chapters = sections.get(1);
        current = new Chapter(createElement(title, Paragraph.class, stylers), chapters.size() + 1);
        chapters.add(current);
    } else {
        List<Section> parents = sections.get(nesting - 1);
        Section parent = parents.get(parents.size() - 1);
        current = parent.addSection(createParagraph(title, stylers));
        sections.get(nesting).add(current);
    }
    return styleHelper.style(current, null, stylers);
}

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

License:Open Source License

private void buildSectionStakeholdersInteractions(Section section) {

    String sectionIntro = "This section describes stakeholders interactions, providing insight on whom they interact with to fulfil their desired objectives, as well as which are the stakeholders that rely on them to fulfil their respective goals. This kind of interaction is carried out by means of%i goal delegations%.";
    section.add(createParagraph(sectionIntro));
    sectionIntro = "To achieve their goals stakeholders might need specific information. If they do not possess this information, they may ask other stakeholders to provide thems documents. %iDocument provision% is used to capture this interaction.";
    section.add(createParagraph(sectionIntro));

    if (generateGoalDelegationsSection()) {
        Section section1 = section.addSection(getSectionTitleParagraph("Goal Delegations"));
        buildSectionGoalDelegations(section1);
        section1.setComplete(true);//from  w ww  . j a va 2 s.co m
    }

    if (generateDocumentProvisionsSection()) {
        Section section2 = section.addSection(getSectionTitleParagraph("Document Provisions"));
        buildSectionDocumentProvisions(section2);
        section2.setComplete(true);
    }
}

From source file:org.fossa.rolp.util.PdfStreamSource.java

License:Open Source License

private Section getKlassenlehrerunterschrift(Section chapterLEB) {
    Paragraph unterschriftParagraph = new Paragraph();
    Section klassenbriefUnterschriftSection = chapterLEB.addSection(unterschriftParagraph);
    klassenbriefUnterschriftSection.setNumberDepth(0);
    unterschriftParagraph//from w ww .  ja v a  2  s .c  o m
            .add(new Phrase(lebData.getKlassenlehrerUnterschrift().replace('\t', '\0'), standardTextFont));
    unterschriftParagraph.setAlignment(Element.ALIGN_RIGHT);
    unterschriftParagraph.add(Chunk.NEWLINE);
    unterschriftParagraph.add(Chunk.NEWLINE);
    return klassenbriefUnterschriftSection;
}