Example usage for com.itextpdf.text Element ALIGN_CENTER

List of usage examples for com.itextpdf.text Element ALIGN_CENTER

Introduction

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

Prototype

int ALIGN_CENTER

To view the source code for com.itextpdf.text Element ALIGN_CENTER.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:com.planning.project.controller.CreatePDF.java

private static void addTitlePageBud(Document document) throws DocumentException, IOException {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(24);//from   ww w. j a  v a 2  s  .c  om

    String imagepath = "src/main/webapp/resources/images/logo.jpg";
    Image img = Image.getInstance(imagepath);
    img.scaleToFit(70f, 70f);

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy");

    Paragraph created = new Paragraph();
    created.setFont(TIME_ROMAN_SMALL);
    created.add("Report created on " + simpleDateFormat.format(new Date()));
    created.setAlignment(Element.ALIGN_RIGHT);

    Paragraph logo = new Paragraph();
    logo.setFont(TIME_ROMAN_SMALL);
    logo.add(img);
    logo.setAlignment(Element.ALIGN_LEFT);
    document.add(created);
    document.add(logo);

    // Paragraph created = new Paragraph();
    // created.setFont(TIME_ROMAN_SMALL);
    // created.add("Report created on " + simpleDateFormat.format(new
    // Date()));
    // created.setAlignment(Element.ALIGN_RIGHT);

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(font);
    paragraph.add(
            "?");

    paragraph.setAlignment(Element.ALIGN_CENTER);
    document.add(paragraph);
    creteEmptyLine(created, 1);

}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableAddmoneyvara(List<TbAddmoneyvara> tbAddmoneyvaras, String getSumAddmoneyvara)
        throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);//from  w  ww. j ava2  s.com

    PdfPTable table = new PdfPTable(5);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase(
            "1.1 ? () ??? ",
            font));
    cell.setColspan(5);
    table.addCell(cell);
    cell = new PdfPCell(
            new Phrase(" = " + getSumAddmoneyvara + " ", font));
    cell.setColspan(5);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("-?", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("?", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" /", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" / ", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    int count = 0;
    for (TbAddmoneyvara items : tbAddmoneyvaras) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(
                items.getTbPerson().getPersonName() + " " + items.getTbPerson().getPersonLastname(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getAddmvaraDate().toString(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getAddmvaraPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getAddmvaraSum(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableAddmoneynovara(List<TbAddmoneynovara> tbAddmoneynovaras,
        String getSumAddmoneynovara) throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);/*from ww  w  .ja v a 2s  .com*/

    PdfPTable table = new PdfPTable(5);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase(
            "1.2 ? () ??? ",
            font));
    cell.setColspan(5);
    table.addCell(cell);
    cell = new PdfPCell(
            new Phrase(" = " + getSumAddmoneynovara + " ", font));
    cell.setColspan(5);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("-?", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("?", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" /", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" / ", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    int count = 0;
    for (TbAddmoneynovara items : tbAddmoneynovaras) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(
                items.getTbPerson().getPersonName() + " " + items.getTbPerson().getPersonLastname(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getAddmnovaraDate().toString(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getAddmnovaraPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getAddmnovaraSum(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableRemunerationcommittee(List<TbRemunerationcommittee> tbRemunerationcommittees,
        String getSumRemunerationcommittees) throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);/*from w ww. j  a  va 2 s  .co  m*/

    PdfPTable table = new PdfPTable(6);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(
            new Phrase("1.3?? ", font));
    cell.setColspan(6);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(
            " = " + getSumRemunerationcommittees + " ", font));
    cell.setColspan(6);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("??", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    int count = 0;
    for (TbRemunerationcommittee items : tbRemunerationcommittees) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getRemunQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getRemunPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getRemunTime(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getRemunSum(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getRemunRemark(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableMaketimeformeal(List<TbMaketimeformeal> tbMaketimeformeals,
        String getSumMaketimeformeals) throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);/*from  w ww  . j  a va  2 s . c  om*/

    PdfPTable table = new PdfPTable(7);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(
            new Phrase("1.4 ??", font));
    cell.setColspan(7);
    table.addCell(cell);
    cell = new PdfPCell(
            new Phrase(" = " + getSumMaketimeformeals + " ", font));
    cell.setColspan(7);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("??", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    int count = 0;
    for (TbMaketimeformeal items : tbMaketimeformeals) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getWork(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getJobovertime(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getPerformerquantityperson(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getPerformerquantityday(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getPerformerquantitymoney(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getPerformerquantitymoneytotal(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableRentshouse(List<TbRentshouse> tbRentshouses, String getSumRentshouses)
        throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);/*from  w  w w . j  a v a  2s. c o  m*/

    PdfPTable table = new PdfPTable(4);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase("1.5 ", font));
    cell.setColspan(4);
    table.addCell(cell);
    cell = new PdfPCell(
            new Phrase(" = " + getSumRentshouses + " ", font));
    cell.setColspan(4);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" - ?", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("/", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" / ", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);

    int count = 0;
    for (TbRentshouse items : tbRentshouses) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(
                items.getTbPerson().getPersonName() + " " + items.getTbPerson().getPersonLastname(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getRentshousePrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getRentshouseSum(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableTeachextra(List<TbTeachextra> tbTeachextras, String getSumTeachextra)
        throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);/*from  ww w . j  av a 2  s.  c o m*/

    PdfPTable table = new PdfPTable(6);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase(
            "1.6 ??? ()",
            font));
    cell.setColspan(6);
    table.addCell(cell);
    cell = new PdfPCell(
            new Phrase(" = " + getSumTeachextra + " ", font));
    cell.setColspan(6);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);

    int count = 0;
    for (TbTeachextra items : tbTeachextras) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getTtPerson(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getTtHour(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getTtWeek(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getTtBath(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getTtSum(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableExpenpaper(List<TbExpenpaper> tbExpenpapers, String getSum)
        throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);/*from ww w  .j a v a2  s  . com*/

    PdfPTable table = new PdfPTable(5);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase(
            "1.6 ??? (?)",
            font));
    cell.setColspan(5);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" = " + getSum + " ", font));
    cell.setColspan(5);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);

    int count = 0;
    for (TbExpenpaper items : tbExpenpapers) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getEpQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getEpMany(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getEpPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getEpSum(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableComlecturer(List<TbComlecturer> tbComlecturers, String getSum)
        throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);/*from   w  ww  .ja  v  a2  s .c  om*/

    PdfPTable table = new PdfPTable(6);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase(
            "1.6 ??? (?????)",
            font));
    cell.setColspan(6);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" = " + getSum + " ", font));
    cell.setColspan(6);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("??", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);

    int count = 0;
    for (TbComlecturer items : tbComlecturers) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getClTopic(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getClPerson(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getClMany(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getClBath(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getClSum(), font)));
    }
    return table;
}

From source file:com.planning.project.controller.CreatePDF.java

public static PdfPTable createtableOthercompensation(List<TbOthercompensation> tbOthercompensations,
        String getSum) throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);//from  ww w.j av a 2s . c o  m

    PdfPTable table = new PdfPTable(4);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase("1.7 ?", font));
    cell.setColspan(4);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(" = " + getSum + " ", font));
    cell.setColspan(4);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("?", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase("?", font));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cell);

    int count = 0;
    for (TbOthercompensation items : tbOthercompensations) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMoney(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getDetail(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getCalculation(), font)));
    }
    return table;
}