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

private static void createPagePDFFormProject2(Document document, TbFormProject tbFormProject,
        List<TbActivity> activity, List<TbDetailSka> detailSka, List<TbDetailSm> detailSms,
        TbFormSubproject subProject) throws DocumentException, IOException {

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

    Paragraph openning = new Paragraph();
    openning.setFont(font);

    creteLine(openning, 1);
    openning.add("??? ");
    creteEmptyLine(openning, 1);
    openning.add("????");
    creteEmptyLine(openning, 1);
    openning.add("???  : "
            + subProject.getTbMonth1().getMonthLong());
    creteEmptyLine(openning, 1);
    openning.add(
            "? : " + subProject.getTbMonth2().getMonthLong());
    creteEmptyLine(openning, 1);
    openning.add(
            "??????? : "
                    + subProject.getTbMonth3().getMonthLong());
    creteEmptyLine(openning, 1);
    openning.add("??");
    creteEmptyLine(openning, 1);
    openning.add(
            "? ????  : "
                    + subProject.getTbMonth4().getMonthLong());
    creteEmptyLine(openning, 1);
    openning.add(
            "???   : "
                    + subProject.getTbMonth5().getMonthLong());
    creteEmptyLine(openning, 1);
    openning.add(
            "//?????   : "
                    + subProject.getTbMonth6().getMonthLong());
    creteEmptyLine(openning, 1);
    openning.add(
            "??? : ( 3 ?)    : "
                    + subProject.getWorkflowPlanBudget());
    creteLine(openning, 1);
    creteEmptyLine(openning, 1);
    document.add(openning);
}

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

public static PdfPTable createtableFollowCheck(TbFormSubproject subProject)
        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 a2s  . c  o m*/

    PdfPTable table = new PdfPTable(3);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase(
            "?? (C_Check)",
            font));
    cell.setColspan(3);
    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);

    table.addCell(new PdfPCell(new Phrase(
            "????",
            font)));
    table.addCell(new PdfPCell(new Phrase(subProject.getFollowCCheckTool(), font)));
    table.addCell(new PdfPCell(new Phrase(subProject.getFollowCCheckTime(), font)));

    table.addCell(new PdfPCell(new Phrase(
            "??",
            font)));
    table.addCell(new PdfPCell(new Phrase(subProject.getAssesCCheckTool(), font)));
    table.addCell(new PdfPCell(new Phrase(subProject.getAssesCCheckTime(), font)));

    table.addCell(new PdfPCell(new Phrase(
            "?? /",
            font)));
    table.addCell(new PdfPCell(new Phrase(subProject.getFollowInCCheckTool(), font)));
    table.addCell(new PdfPCell(new Phrase(subProject.getFollowInCCheckTime(), font)));

    return table;

}

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

public static PdfPTable createtablePro(TbFormProject tbFormProject) 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 a2s.c  o  m*/

    PdfPTable table = new PdfPTable(5);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell cell = new PdfPCell(new Phrase(
            "/ :/",
            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);

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getProQuantitative(), font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getProQualitative(), font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getProTiming(), font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getProCost(), font)));
    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsQuantitative(), font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsQualtitative(), font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsTiming(), font)));
    table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsCost(), font)));

    return table;

}

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

private static void createPagePDFFormProject3(Document document, TbFormProject tbFormProject,
        List<TbActivity> activity, List<TbDetailSka> detailSka, List<TbDetailSm> detailSms,
        TbFormSubproject subProject) throws DocumentException, IOException {

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

    Paragraph openning = new Paragraph();
    openning.setFont(font);

    creteLine(openning, 1);
    creteEmptyLine(openning, 1);
    openning.add(
            "(?????)");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getResults());
    creteEmptyLine(openning, 1);
    openning.add(
            "?/ ? ()");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getProblem());
    creteEmptyLine(openning, 1);
    openning.add(
            "??/? ()");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getDevelopmentPlan());
    creteEmptyLine(openning, 1);

    openning.add(
            "???");
    creteEmptyLine(openning, 1);
    document.add(openning);

    openning.add(
            "?? (???? ? ? ??? ??  ?)");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskPolitics());
    creteEmptyLine(openning, 1);
    openning.add(
            "????/?");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskDefPolitics());
    creteLine(openning, 1);
    creteEmptyLine(openning, 1);

    openning.add(
            "??/? (??? ?/? /?? ?? ?)");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskPolicy());
    creteEmptyLine(openning, 1);
    openning.add(
            "????/?");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskDefPolicy());
    creteLine(openning, 1);
    creteEmptyLine(openning, 1);

    openning.add(
            "??? (? ??? ? ? ??)");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskWorkflow());
    creteEmptyLine(openning, 1);
    openning.add(
            "????/?");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskDefWorkflow());
    creteLine(openning, 1);
    creteEmptyLine(openning, 1);

    openning.add(
            "???? (? ?? ?????)");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskFinance());
    creteEmptyLine(openning, 1);
    openning.add(
            "????/?");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskDefFinance());
    creteLine(openning, 1);
    creteEmptyLine(openning, 1);

    openning.add(
            " (?   ???)");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskTechnology());
    creteEmptyLine(openning, 1);
    openning.add(
            "????/?");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskDefTechnology());
    creteLine(openning, 1);
    creteEmptyLine(openning, 1);

    openning.add(
            "? (?????    ?)");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskEnvironment());
    creteEmptyLine(openning, 1);
    openning.add(
            "????/?");
    creteEmptyLine(openning, 1);
    openning.add(": " + tbFormProject.getRiskDefEnvironment());
    creteLine(openning, 1);
    creteEmptyLine(openning, 1);
    document.add(openning);
}

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

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

    Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
    font.setSize(24);/* www  .ja  v  a  2s.  co m*/

    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

private static void createPagePDFBudwork(Document document, TbDescriptionstatement tbDescriptionstatement)
        throws DocumentException, IOException {

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

    Paragraph title = new Paragraph();

    title.setFont(font);
    creteEmptyLine(title, 1);
    title.setFont(font);
    title.add(": " + tbDescriptionstatement.getTbBudget().getBudgetName());
    creteEmptyLine(title, 1);
    title.add(": " + tbDescriptionstatement.getTbYear().getYearValue());
    creteEmptyLine(title, 1);
    title.add(": " + tbDescriptionstatement.getTbFaculty().getFacultyName());
    creteEmptyLine(title, 1);
    title.add(
            ": " + tbDescriptionstatement.getTbFaculty().getTbCampus().getCampusName());
    creteEmptyLine(title, 1);
    title.add(" : " + tbDescriptionstatement.getTbProduct().getProductName());
    creteEmptyLine(title, 1);
    title.add(": "
            + tbDescriptionstatement.getTbBudgetType().getBdTypeName());
    creteEmptyLine(title, 1);
    title.add(": "
            + tbDescriptionstatement.getTotal() + " ");
    creteEmptyLine(title, 1);
    /*
     * title.add(": " +
     * tbDescriptionstatement.getAllocateMoney() + " ");
     * creteEmptyLine(title, 1); title.add(": "
     * + (Integer.parseInt(tbDescriptionstatement.getAllocateMoney()) -
     * Integer.parseInt(tbDescriptionstatement.getMoneyBalance())) + " "
     * ); creteEmptyLine(title, 1); title.add(": " +
     * tbDescriptionstatement.getMoneyBalance() + " ");
     * creteEmptyLine(title, 1);
     */

    document.add(title);

}

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

private static void createHeadlistBudwork(Document document, String check)
        throws DocumentException, IOException {

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

    Paragraph title = new Paragraph();
    title.setFont(font);
    creteEmptyLine(title, 1);

    if (check == "1") {
        title.add("1. ?");
    } else if (check == "2") {
        title.add("2. ");
    } else if (check == "3") {
        title.add("3. ");
    } else if (check == "4") {
        title.add("4. ");
    }
    creteLine(title, 1);
    creteEmptyLine(title, 1);
    document.add(title);

}

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);// ww  w .  jav  a2  s.  c  o m

    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 w  w .jav a 2s. c o m*/

    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);/*  w  w w  .  j a v  a2  s. c  om*/

    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;
}