Example usage for com.itextpdf.text Section add

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

Introduction

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

Prototype

@Override
public boolean add(final Element element) 

Source Link

Document

Adds a Paragraph, List, Table or another Section to this Section.

Usage

From source file:edu.avans.ivh5.shared.util.generateInvoicePDF.java

private static void createTable2(Section preface) throws BadElementException {

    PdfPTable table = new PdfPTable(1);

    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);

    table.addCell("Factuur nummer");
    table.addCell("Factuuratum");
    table.addCell("Vervaldatum");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");

    preface.add(table);

}

From source file:edu.avans.ivh5.shared.util.generateInvoicePDF.java

private static void createTable3(Section preface) throws BadElementException {

    PdfPTable table = new PdfPTable(4);

    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);

    table.addCell("Behandelcode");
    table.addCell("Aantal sessies");
    table.addCell("Prijs per sessie");
    table.addCell("Totaal");
    table.addCell("AAA01CS");
    table.addCell("2");
    table.addCell(" 30");
    table.addCell(" 60");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");

    preface.add(table);

}

From source file:edu.avans.ivh5.shared.util.generateInvoicePDF.java

private static void createTable4(Section preface) throws BadElementException {

    PdfPTable table = new PdfPTable(2);

    //PdfPCell cell = new PdfPCell(new Paragraph("header with colspan 3"));
    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);

    //cell.setColspan(3);
    // table.addCell(cell);
    table.addCell("Eigenrisco");
    table.addCell("Te betalen");
    table.addCell(" 140");
    table.addCell(" 0");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");
    table.addCell(" ");

    preface.add(table);

}

From source file:edu.avans.ivh5.shared.util.generateInvoicePDF.java

private static void createTable5(Section preface) throws BadElementException {

    PdfPTable table = new PdfPTable(1);

    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);

    table.addCell("Gelieve te betalen binnen 30 dagen");
    table.addCell(" ");
    table.addCell(" ");

    preface.add(table);

}

From source file:edu.esprit.pi.gui.internalframes.PDFwithItextInternalFrame.java

public void createTable(Section subCatPart) throws BadElementException {
    PdfPTable table = new PdfPTable(3);
    PdfPCell c1 = new PdfPCell(new Phrase("Client"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);/*from   w w  w .  j ava 2  s  .  co  m*/

    c1 = new PdfPCell(new Phrase("Article"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Quantit"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);

    // Rcupration de la liste des articles.
    java.util.List<Article> listArticles = new ArticleDAO().findAll();
    // remplissare des cellules de la liste
    for (Article article : listArticles) {
        table.addCell("" + article.getClient().getNom());
        table.addCell("" + article.getStock().getLibelle());
        table.addCell("" + article.getQuantite());
    }
    subCatPart.add(table);
}

From source file:edu.esprit.pi.gui.internalframes.PDFwithItextInternalFrame.java

public void createList(Section subCatPart) {
    List list = new List(true, false, 10);
    list.add(new ListItem("Premier point"));
    list.add(new ListItem("Deuxime point"));
    list.add(new ListItem("Troisime point"));
    subCatPart.add(list);
}

From source file:edu.esprit.pi.gui.internalframes.PDFwithItextInternalFrame.java

public void addContent(Document document) throws DocumentException {
    Anchor anchor = new Anchor(titreChapitre1jTextField.getText(), catFont);
    //anchor.setName("First Chapter");

    // le socond paramtre est le numro du chapitre.
    Chapter catPart = new Chapter(new Paragraph(anchor), 1);

    Paragraph subPara = new Paragraph(titreParagraphe1TextField.getText(), subFont);
    Section subCatPart = catPart.addSection(subPara);

    subCatPart.add(new Paragraph(descriptionjTextArea.getText()));

    // Nouvelle /*from  www . j a  va 2  s  . c o m*/
    Paragraph subPara2 = new Paragraph(description3jTextArea.getText(), subFont);
    Section subCatPart2 = catPart.addSection(subPara2);
    subCatPart2.add(new Paragraph(description4jTextArea.getText()));
    // Ajouter une liste de sections
    createList(subCatPart2);
    Paragraph paragraph = new Paragraph();
    addEmptyLine(paragraph, 3);
    subCatPart2.add(paragraph);

    // Ajouter un tableau
    createTable(subCatPart2);

    // Ajouter tout cela au document.
    document.add(catPart);

    // Nouvelle Section    
    anchor = new Anchor(titreChapitre2jTextField.getText(), catFont);
    //anchor.setName("Second Chapter");

    // Le socond paramtre est le numro du chapitre
    catPart = new Chapter(new Paragraph(anchor), 1);
    subPara = new Paragraph(titreParagraphe2jTextField.getText(), subFont);
    subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph(description2jTextArea.getText()));
    // ajouter au document
    document.add(catPart);

}

From source file:Ekon.zamestnanecToPDF.java

/**
 * pridani titulku//from   w  w w  .  j a  v a  2s .  c o m
 *
 * @param dokument
 * @throws DocumentException
 */
private static void addTitlePage(Document document, Zamestnanec zam) throws DocumentException {
    if (zam == null) {
        System.out.println("chyba");
        return;
    }
    String jmeno = zam.getJmeno();
    String prijmeni = zam.getPrijmeni();
    String datumNarozeni = zam.getDatumNarozeni();
    String mesto = zam.getMesto();
    String ulice = zam.getUlice();
    String kraj = zam.getKraj();
    String pozice = zam.getPozice();
    Anchor anchor = new Anchor("Vypis zamestnance", catFont);
    anchor.setName("Vypis zamestnance");

    // Second parameter is the number of the chapter
    Chapter catPart = new Chapter(new Paragraph(anchor), 1);

    Paragraph subPara = new Paragraph("Zamestnanec", subFont);
    Section subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph("Jmeno : " + jmeno));
    subCatPart.add(new Paragraph("Prijmeni : " + prijmeni));
    subCatPart.add(new Paragraph("Datum narozeni : " + datumNarozeni));
    subCatPart.add(new Paragraph("Mesto : " + mesto));
    subCatPart.add(new Paragraph("Ulice: " + ulice));
    subCatPart.add(new Paragraph("Kraj : " + kraj));
    subCatPart.add(new Paragraph("Pozice : " + pozice));

    subPara = new Paragraph("Vypis hodin", subFont);
    subCatPart = catPart.addSection(subPara);

    Paragraph paragraph = new Paragraph();
    addEmptyLine(paragraph, 3);
    subCatPart.add(paragraph);

    // add a table
    createTable(subCatPart);

    // now add all this to the document
    document.add(catPart);
}

From source file:Ekon.zamestnanecToPDF.java

private static void createTable(Section subCatPart) throws BadElementException {
    PdfPTable table = new PdfPTable(3);

    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);
    PdfPCell c1 = new PdfPCell(new Phrase("Mesic"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);//  w  w w  . j a v a2 s . c  o  m

    c1 = new PdfPCell(new Phrase("Pocet odpracovanych hodin hodin"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);
    subCatPart.add(table);

}

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

License:Open Source License

private void buildSectionSocialDiagram(Section section, Document document) {

    Image i = rsp.generateScrenshot(ViewsManager.SOCIAL_VIEW);
    float reductionScale = fitImageInArea(i,
            document.getPageSize().getWidth() - document.rightMargin() - document.leftMargin(), 310, false);
    if (reductionScale <= getMaximumReductionScale()) {
        setAppendixASocialDiagram(true);
    }//from   w ww  . j av a  2  s.c o m

    StringBuilder sectionIntro = new StringBuilder();
    sectionIntro.append(ftc.getFigure(FigureConstant.SOCIAL_DIAGRAM)
            + " presents the graphical representation of the social view");
    if (needSocialDiagramInAppendixA()) {
        sectionIntro.append(" (a larger picture is shown in appendix A)");
    }
    sectionIntro.append(".");
    section.add(createParagraph(sectionIntro.toString()));

    section.add(decorateImage(i, ftc.getFigure(FigureConstant.SOCIAL_DIAGRAM) + " - Social View for the "
            + getProjectName() + " project"));
    section.setComplete(true);
}