Example usage for com.itextpdf.text Font Font

List of usage examples for com.itextpdf.text Font Font

Introduction

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

Prototype


public Font(final FontFamily family) 

Source Link

Document

Constructs a Font.

Usage

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

public static PdfPTable createtableEmploy(List<TbEmploy> tbEmploys, String getSum)
        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  a2s  .  c  om*/

    PdfPTable table = new PdfPTable(4);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase("2.14 ", 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 (TbEmploy items : tbEmploys) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getEmploymoney(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getDetail(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getCalculation(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial1(List<TbMaterial> tbMaterials1, String getSum)
        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 2 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("3.1 ?", 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 (TbMaterial items : tbMaterials1) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial2(List<TbMaterial> tbMaterials2, String getSum)
        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  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("3.2 ?", 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 (TbMaterial items : tbMaterials2) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial3(List<TbMaterial> tbMaterials3, 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  .  jav  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("3.3 ", 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 (TbMaterial items : tbMaterials3) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial4(List<TbMaterial> tbMaterials4, 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 .  java2 s. com

    PdfPTable table = new PdfPTable(6);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(
            new Phrase("3.4 ?", 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 (TbMaterial items : tbMaterials4) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial5(List<TbMaterial> tbMaterials5, String getSum)
        throws DocumentException, Exception {

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(16);//from  w w  w. ja  v  a  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(
            "3.5 ??",
            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 (TbMaterial items : tbMaterials5) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial6(List<TbMaterial> tbMaterials6, String getSum)
        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  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("3.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 (TbMaterial items : tbMaterials6) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial7(List<TbMaterial> tbMaterials7, String getSum)
        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 a2s.  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("3.7 ", 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 (TbMaterial items : tbMaterials7) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial8(List<TbMaterial> tbMaterials8, String getSum)
        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 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("3.8 ??", 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 (TbMaterial items : tbMaterials8) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}

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

public static PdfPTable createtableMaterial9(List<TbMaterial> tbMaterials9, 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 . j  a  va  2s . 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("3.9 ", 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 (TbMaterial items : tbMaterials9) {
        count++;
        table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMName(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMQty(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMNub(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font)));
        table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font)));
    }
    return table;
}