Example usage for com.itextpdf.text.pdf PdfPCell setPaddingTop

List of usage examples for com.itextpdf.text.pdf PdfPCell setPaddingTop

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPCell setPaddingTop.

Prototype

public void setPaddingTop(float paddingTop) 

Source Link

Document

Setter for property paddingTop.

Usage

From source file:utils.pdf.cv_templates.Template4.java

private void addLanguage(List<Language> languageList) throws DocumentException {
    Paragraph paragraph;/*w  w  w  .  j  a v a 2  s  .  c om*/
    PdfPCell cell;
    PdfPTable table;

    for (int i = 0; i < languageList.size(); i++) {

        table = new PdfPTable(new float[] { 1f, 2.25f });
        table.setWidthPercentage(100);
        table.setSpacingBefore(5);

        //First column
        cell = new PdfPCell();
        cell.setBorder(PdfPCell.RIGHT);
        if (i == 0) {
            paragraph = new Paragraph("IDIOMAS", font1);
            cell.setBorder(PdfPCell.RIGHT);
        } else {
            paragraph = new Paragraph("");
        }
        paragraph.setAlignment(Paragraph.ALIGN_RIGHT);
        cell.setPaddingRight(10);
        cell.addElement(paragraph);
        table.addCell(cell);

        //Second column
        cell = new PdfPCell();
        cell.setPaddingLeft(10);
        cell.setPaddingTop(0);
        cell.setBorder(PdfPCell.NO_BORDER);
        paragraph = new Paragraph("");
        cell.addElement(paragraph);
        table.addCell(cell);

        //First column
        cell = new PdfPCell();
        cell.setBorder(PdfPCell.RIGHT);
        paragraph = new Paragraph("Nombre", font2);
        cell.setBorder(PdfPCell.RIGHT);

        paragraph.setAlignment(Paragraph.ALIGN_RIGHT);
        cell.setPaddingRight(10);
        cell.addElement(paragraph);
        table.addCell(cell);

        //Second column
        cell = new PdfPCell();
        cell.setPaddingLeft(10);
        cell.setPaddingTop(0);
        cell.setBorder(PdfPCell.NO_BORDER);
        paragraph = new Paragraph(languageList.get(i).language, font2);
        cell.addElement(paragraph);
        table.addCell(cell);

        //First column
        cell = new PdfPCell();
        cell.setBorder(PdfPCell.RIGHT);
        paragraph = new Paragraph("Nivel", font2);
        cell.setBorder(PdfPCell.RIGHT);

        paragraph.setAlignment(Paragraph.ALIGN_RIGHT);
        cell.setPaddingRight(10);
        cell.addElement(paragraph);
        table.addCell(cell);

        //Second column
        cell = new PdfPCell();
        cell.setPaddingLeft(10);
        cell.setPaddingTop(0);
        cell.setBorder(PdfPCell.NO_BORDER);
        paragraph = new Paragraph(languageList.get(i).level, font2);
        cell.addElement(paragraph);
        table.addCell(cell);

        document.add(table);
    }
}