Example usage for com.itextpdf.text Section setNumberDepth

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

Introduction

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

Prototype

public void setNumberDepth(final int numberDepth) 

Source Link

Document

Sets the depth of the sectionnumbers that will be shown preceding the title.

Usage

From source file:eu.trentorise.smartcampus.citizenportal.service.PdfCreator.java

private static void addContent(Document document) throws DocumentException {
    Anchor anchor = new Anchor("COMUNITA' DELLA VALLAGARINA", catFont);
    anchor.setName("COMUNITA' DELLA VALLAGARINA");
    // Second parameter is the number of the chapter
    Chapter catPart = new Chapter(new Paragraph(anchor), 1);
    catPart.setNumberDepth(0);//from w  ww  .  j  a  v  a  2s .c o  m
    Paragraph subPara = new Paragraph("Graduatoria Generale", subFont);
    Section subCatPart = catPart.addSection(subPara);
    subCatPart.setNumberDepth(0);
    Anchor phaseClass = new Anchor("Fase: " + phase, smallBold);
    Anchor state = new Anchor("Stato: Confermata", smallBold);
    Anchor edFinPer = new Anchor("Edizione: " + edFin.getPeriod(), smallBold);
    Anchor edFinCat = new Anchor("Categoria: " + edFin.getCategory(), smallBold);
    Anchor edFinTool = new Anchor("Strumento: " + edFin.getTool(), smallBold);
    // subCatPart.add(new Paragraph("Graduatoria: Generale"));
    subCatPart.add(new Paragraph(phaseClass));
    subCatPart.add(new Paragraph(state));
    subCatPart.add(new Paragraph(edFinPer));
    subCatPart.add(new Paragraph(edFinCat));
    subCatPart.add(new Paragraph(edFinTool));
    // add a list
    // createList(subCatPart);
    Paragraph paragraph = new Paragraph();
    addEmptyLine(paragraph, 1);
    subCatPart.add(paragraph);
    // add a table
    createTable(subCatPart);
    // now add all this to the document
    document.add(catPart);
    // Next section
    // anchor = new Anchor("Second Chapter", catFont);
    // anchor.setName("Second Chapter");
    // Second parameter is the number of the chapter
    // catPart = new Chapter(new Paragraph(anchor), 1);
    // subPara = new Paragraph("Subcategory", subFont);
    // subCatPart = catPart.addSection(subPara);
    // subCatPart.add(new Paragraph("This is a very important message"));
    // now add all this to the document
    // document.add(catPart);
}

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

License:Open Source License

private void addContent(PdfWriter writer) throws DocumentException, PdfFormatierungsException {
    Anchor anchor = new Anchor("Lernentwicklungsbericht", lernentwicklungsberichtUeberschriftFont);
    Chapter chapterLEB = new Chapter(new Paragraph(anchor), 1);
    chapterLEB.setNumberDepth(0);//  w ww  . ja  v  a2 s  .  com
    Paragraph paragraphHeader = new Paragraph();
    paragraphHeader.setLeading(FIXED_LEADING_TEXT, 1);
    sectionCount += 1;
    Section headerSection = chapterLEB.addSection(paragraphHeader);
    headerSection.setNumberDepth(0);

    paragraphHeader.add(Chunk.NEWLINE);
    paragraphHeader.add(PdfFormatHelper.buildHeaderNameLine(lebData.getSchuelername(), headerFont));
    paragraphHeader.add(Chunk.NEWLINE);
    paragraphHeader.add(PdfFormatHelper.buildHeaderKlassendatenLine(lebData, headerFont));
    headerSection.add(Chunk.NEWLINE);
    headerSection.add(Chunk.NEWLINE);
    document.add(chapterLEB);
    insertDummyLineIfNecessary(writer);

    addKlassenbrief(chapterLEB, writer);
    addIndividuelleEinschaetzung(chapterLEB, writer);
    addFacheinschaetzungen(chapterLEB, writer);
}

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

License:Open Source License

private void addFacheinschaetzungen(Chapter chapterLEB, PdfWriter writer)
        throws DocumentException, PdfFormatierungsException {
    for (LebFacheinschaetzungData facheinschaetzungsdaten : lebData.getFacheinschaetzungsdaten()) {
        sectionCount += 1;//from w  w  w  .  ja v  a  2 s. com
        breakHurenkind(writer);
        breakSchusterjunge(writer);
        Paragraph paragraphFacheinschaetzung = new Paragraph();
        Section facheinschaetzungsTextSection = chapterLEB.addSection(paragraphFacheinschaetzung);
        facheinschaetzungsTextSection.setNumberDepth(0);
        Collection<String> fachbezeichnungen = facheinschaetzungsdaten.getFachbezeichnungen();
        fachbezeichnungen.add(facheinschaetzungsdaten.getFachname());

        String facheinschaetzung = facheinschaetzungsdaten.getFacheinschaetzung();

        Integer firstIndex = null;
        String boldedWord = "";
        for (String fachbezeichnung : fachbezeichnungen) {
            int index = facheinschaetzung.toLowerCase().indexOf(fachbezeichnung.toLowerCase());
            if (index != -1 && (firstIndex == null || firstIndex > index)) {
                firstIndex = index;
                boldedWord = fachbezeichnung;
            }
        }
        Paragraph facheinschaetzungParapgraph = new Paragraph();
        facheinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
        facheinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
        if (firstIndex == null) {
            facheinschaetzungParapgraph.add(new Phrase(
                    facheinschaetzungsdaten.getFacheinschaetzung().replace('\t', '\0'), standardTextFont));
        } else {
            String beforeBoldWord = facheinschaetzung.substring(0, firstIndex);
            facheinschaetzungParapgraph.add(new Phrase(beforeBoldWord.replace('\t', '\0'), standardTextFont));

            String boldWord = facheinschaetzung.substring(firstIndex, firstIndex + boldedWord.length());
            facheinschaetzungParapgraph.add(new Phrase(boldWord, standardTextBoldFont));

            String afterBoldWord = facheinschaetzung.substring(firstIndex + boldedWord.length());
            facheinschaetzungParapgraph.add(new Phrase(afterBoldWord.replace('\t', '\0'), standardTextFont));
        }
        facheinschaetzungParapgraph.setFont(standardTextFont);
        facheinschaetzungsTextSection.add(facheinschaetzungParapgraph);
        Paragraph unterschriftParagraph = new Paragraph();
        document.add(facheinschaetzungsTextSection);
        Section facheinschaetzungsUnterschriftSection = chapterLEB.addSection(unterschriftParagraph);
        facheinschaetzungsUnterschriftSection.setNumberDepth(0);
        unterschriftParagraph.add(
                new Phrase(facheinschaetzungsdaten.getUnterschrift().replace('\t', '\0'), standardTextFont));
        unterschriftParagraph.setAlignment(Element.ALIGN_RIGHT);
        unterschriftParagraph.add(Chunk.NEWLINE);
        unterschriftParagraph.add(Chunk.NEWLINE);
        document.add(facheinschaetzungsUnterschriftSection);
        alertHurenkind(writer);
        insertDummyLineIfNecessary(writer);
    }
}

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

License:Open Source License

private void addIndividuelleEinschaetzung(Chapter chapterLEB, PdfWriter writer)
        throws DocumentException, PdfFormatierungsException {
    if (!lebData.getIndividuelleEinschaetzung().isEmpty()) {
        sectionCount += 1;/*from   w ww  . j av  a  2 s . c o m*/
        breakHurenkind(writer);
        breakSchusterjunge(writer);
        Paragraph paragraphIndividuelleEinschaetzung = new Paragraph();
        Section individuelleEinschaetzungsTextSection = chapterLEB
                .addSection(paragraphIndividuelleEinschaetzung);
        individuelleEinschaetzungsTextSection.setNumberDepth(0);
        Paragraph schuelereinschaetzungParapgraph = new Paragraph(
                lebData.getIndividuelleEinschaetzung().replace('\t', '\0'), standardTextFont);
        schuelereinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
        schuelereinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
        individuelleEinschaetzungsTextSection.add(schuelereinschaetzungParapgraph);
        document.add(individuelleEinschaetzungsTextSection);
        document.add(getKlassenlehrerunterschrift(chapterLEB));
        alertHurenkind(writer);
        insertDummyLineIfNecessary(writer);
    }
}

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

License:Open Source License

private void addKlassenbrief(Chapter chapterLEB, PdfWriter writer)
        throws DocumentException, PdfFormatierungsException {
    if (!lebData.getKlassenbrief().isEmpty()) {
        sectionCount += 1;/*  w  w  w  .j a v a 2  s.  com*/
        breakSchusterjunge(writer);
        Paragraph paragraphKlassenbrief = new Paragraph();
        Section klassenbriefSection = chapterLEB.addSection(paragraphKlassenbrief);
        klassenbriefSection.setNumberDepth(0);
        Paragraph klasseneinschaetzungParapgraph = new Paragraph(lebData.getKlassenbrief().replace('\t', '\0'),
                standardTextFont);
        klasseneinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
        klasseneinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
        klasseneinschaetzungParapgraph.add(Chunk.NEWLINE);
        if (lebData.getIndividuelleEinschaetzung().isEmpty()) {
            klassenbriefSection.add(klasseneinschaetzungParapgraph);
            document.add(klassenbriefSection);
            document.add(getKlassenlehrerunterschrift(chapterLEB));
        } else {
            klasseneinschaetzungParapgraph.add(Chunk.NEWLINE);
            klassenbriefSection.add(klasseneinschaetzungParapgraph);
            document.add(klassenbriefSection);
        }
        alertLonelyHeader(writer);
        insertDummyLineIfNecessary(writer);
    }
}

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// w  w  w .  jav a2s  .  com
            .add(new Phrase(lebData.getKlassenlehrerUnterschrift().replace('\t', '\0'), standardTextFont));
    unterschriftParagraph.setAlignment(Element.ALIGN_RIGHT);
    unterschriftParagraph.add(Chunk.NEWLINE);
    unterschriftParagraph.add(Chunk.NEWLINE);
    return klassenbriefUnterschriftSection;
}

From source file:org.sharegov.cirm.utils.PDFExportUtil.java

License:Apache License

private static void addContent(Document doc, Json data) throws DocumentException {
    Anchor anchor = new Anchor(); //new Anchor("First Chapter", catFont);
    //anchor.setName("First Chapter Anchor");

    Chapter catPart = new Chapter(new Paragraph(anchor), 1);
    catPart.setNumberDepth(0);//  w w  w. ja va 2  s. c  om
    Paragraph subPara = new Paragraph(); //new Paragraph("SubCategory 1", subFont);
    Section subCatPart = catPart.addSection(subPara);
    subCatPart.setNumberDepth(0);

    createTable(subCatPart, data);

    //Add everything to the document
    doc.add(catPart);
}

From source file:org.sharegov.cirm.utils.PDFViewReport.java

License:Apache License

private void addContent(Document d, Json data) {
    Anchor anchor = new Anchor();
    Chapter catPart = new Chapter(new Paragraph(anchor), 1);
    catPart.setNumberDepth(0);//from  w  ww.j av  a  2  s.  co m
    Paragraph subPara = new Paragraph(); //new Paragraph("SubCategory 1", subFont);
    Section subCatPart = catPart.addSection(subPara);
    subCatPart.setNumberDepth(0);

    try {
        addTopTable(subCatPart, data);
        addDescription(subCatPart, data);
        addQuestions(subCatPart, data);
        addActors(subCatPart, data);
        addActivities(subCatPart, data);
        d.add(catPart);
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException("Problem during addContend for BO: " + data.toString(), e);
    }
}

From source file:org.sharegov.cirm.utils.PDFViewReport.java

License:Apache License

private Section addSection(Chapter chapter) {
    Section section = chapter.addSection(new Paragraph());
    section.setNumberDepth(0);
    return section;
}