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.dandymadeproductions.myjsqlview.structures.DataExportProperties.java

License:Open Source License

private void loadPDFFonts() {
    // Method Instances.
    String fileSeparator;/*from   w w w .  j a v  a2 s  .co  m*/
    String fontPath, fontName;
    String fontsDirectoryName;
    Iterator<String> fontNameIterator;
    File fontsDirectory;
    File[] fontsSubDirectories;
    String[] fontNames;
    TreeSet<String> fonts;

    // Setting up.
    fileSeparator = MyJSQLView_Utils.getFileSeparator();
    fontsDirectoryName = "fonts" + fileSeparator;
    fonts = new TreeSet<String>();

    // Insure have one default font.

    fontTreeMap.put(PDFExportPreferencesPanel.DEFAULT_FONT, new Font(Font.FontFamily.UNDEFINED));

    // Create the default registered fonts.

    fontNameIterator = FontFactory.getRegisteredFonts().iterator();

    while (fontNameIterator.hasNext()) {
        fontName = fontNameIterator.next();
        fontTreeMap.put(fontName, FontFactory.getFont(fontName));
    }

    // Create embedded fonts from fonts directory.

    fontsDirectory = new File(fontsDirectoryName);

    if (fontsDirectory.exists()) {
        // Handle one level of sub-directories.
        fontsSubDirectories = fontsDirectory.listFiles(directoriesFilter);

        for (int i = 0; i < fontsSubDirectories.length; i++) {
            fontNames = fontsSubDirectories[i].list(fontNameFilter);

            for (int j = 0; j < fontNames.length; j++)
                fonts.add(fontsSubDirectories[i] + fileSeparator + fontNames[j]);
        }

        // Handle all direct font names in the directory.
        fontNames = fontsDirectory.list(fontNameFilter);

        for (int i = 0; i < fontNames.length; i++)
            fonts.add(fontsDirectoryName + fontNames[i]);

        // Load the found fonts.
        fontNameIterator = fonts.iterator();

        while (fontNameIterator.hasNext()) {
            fontPath = fontNameIterator.next();
            if (fontPath.indexOf(fileSeparator) != -1)
                fontName = fontPath.substring((fontPath.lastIndexOf(fileSeparator) + 1), fontPath.indexOf("."));
            else
                fontName = fontPath.substring(0, fontPath.indexOf("."));

            // System.out.println(fontName + " " + fontPath);
            try {
                BaseFont currentBaseFont = BaseFont.createFont(fontPath, BaseFont.IDENTITY_H,
                        BaseFont.EMBEDDED);
                fontTreeMap.put(fontName, new Font(currentBaseFont, 12));
            } catch (DocumentException de) {
            } catch (IOException ioe) {
            }
        }
    }
}

From source file:com.github.wolfposd.imsqti2pdf.PDFCreator.java

License:Open Source License

private Chunk getQuestionNumberChunk(Font f, int number) {
    Chunk c = new Chunk((number + 1) + ". ");
    Font ff = new Font(f);
    ff.setStyle(Font.BOLD);/*from   www.  j  a v a 2 s.co m*/
    c.setFont(ff);
    return c;
}

From source file:com.github.wolfposd.imsqti2pdf.PDFCreator.java

License:Open Source License

private Chunk getPointsChunk(Font f, Question question) {
    int points = (int) question.getPointsPerAnswer();
    String punkteText = LocaleStrings.getString(points == 1 ? "point" : "points");

    String text;//from w ww.j a  va2 s  .co m
    if (question.basetype == BaseType.STRING) {
        text = " " + LocaleStrings.getString("maximum"); //(maximal %d %s)
        text = String.format(text, points, punkteText);
    } else {
        if (question.type.equalsIgnoreCase("single")) {
            text = " " + LocaleStrings.getString("correctAnswer"); //" (1 richtige Antwort";

            if (points == 1) {
                text += ")";
            } else {
                text += ", %d %s)";
                text = String.format(text, points, punkteText);
            }
        } else { // MUTLIPLE
            text = " " + LocaleStrings.getString("perCorrectAnswer"); //(%d %s pro richtige Antwort)";
            text = String.format(text, points, punkteText);
        }
    }

    Chunk c = new Chunk(text);
    Font ff = new Font(f);
    ff.setSize(OVERALLFONTSIZE);
    c.setFont(ff);
    return c;
}

From source file:com.masscustsoft.service.ToPdf.java

License:Open Source License

private void processMacro(String buf, BaseFont base, Map it, Paragraph p)
        throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    List<String> list = LightUtil.splitMacro(buf, '$');
    for (String ss : list) {
        Chunk ch = null;/*from   w  w w.  j  av  a  2  s  .co  m*/
        if (ss.equals("${pageNumber}")) {
            PdfWriter writer = getWriter();
            if (writer != null)
                ss = writer.getPageNumber() + "";
            else
                ss = ThreadHelper.get("pageNumber") + "";
        } else if (ss.equals("${pageCount}")) {
            ss = ThreadHelper.get("pageCount") + "";
        } else if (ss.equals("${newPage}")) {
            ch = Chunk.NEXTPAGE;
        } else if (ss.equals("${newLine}")) {
            ch = Chunk.NEWLINE;
        }
        if (ch == null)
            ch = new Chunk(ss, new Font(base));
        applyFont(ch, it);

        String gt = MapUtil.getStr(it, "goto", null);
        if (gt != null) {
            ch.setLocalGoto(gt);
        }

        p.add(ch);
    }
}

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

/**
 * @param args/*  www  . j ava 2 s .  c  om*/
 * @throws Exception
 */
public static Document createPDFBudwork(String file, TbDescriptionstatement tbDescriptionstatement,
        List<TbAddmoneyvara> tbAddmoneyvaras, List<TbAddmoneynovara> tbAddmoneynovaras,
        List<TbRemunerationcommittee> tbRemunerationcommittees, List<TbMaketimeformeal> tbMaketimeformeals,
        List<TbRentshouse> tbRentshouses, List<TbTeachextra> tbTeachextras, List<TbExpenpaper> tbExpenpapers,
        List<TbComlecturer> tbComlecturers, List<TbOthercompensation> tbOthercompensations,
        List<TbAllowancesrental> tbAllowancesrentals, List<TbRepairofequipment> tbRepairofequipments,
        List<TbWageservice> tbWageservices, List<TbMeetingofthesnack> tbMeetingofthesnacks,
        List<TbSocialsecurity> tbSocialsecuritys, List<TbRentalproperty> tbRentalpropertys,
        List<TbThecertificationfood> tbThecertificationfoods,
        List<TbThecertificationdrink> tbThecertificationdrinks, List<TbThegift> tbThegifts, List<TbTax> tbTaxs,
        List<TbFee> tbFees, List<TbInsurance> tbInsurances, List<TbEmploy> tbEmploys,
        List<TbMaterial> tbMaterials1, List<TbMaterial> tbMaterials2, List<TbMaterial> tbMaterials3,
        List<TbMaterial> tbMaterials4, List<TbMaterial> tbMaterials5, List<TbMaterial> tbMaterials6,
        List<TbMaterial> tbMaterials7, List<TbMaterial> tbMaterials8, List<TbMaterial> tbMaterials9,
        List<TbMaterial> tbMaterials10, List<TbMaterial> tbMaterials11, List<TbPublicutility> tbPublicutilitys,
        List<TbGasolineDetail> tbGasolineDetails) throws Exception {

    Document document = null;

    try {
        Font font16 = new Font(
                BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
        font16.setSize(16);
        document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(file));
        document.open();
        Paragraph paragraph = new Paragraph();

        addMetaData(document);

        addTitlePageBud(document);

        createPagePDFBudwork(document, tbDescriptionstatement);

        createHeadlistBudwork(document, "1");

        PdfPTable table = createtableAddmoneyvara(tbAddmoneyvaras, tbDescriptionstatement.getSumAddmoneyvara());
        document.add(table);
        table.setSpacingBefore(25);

        table = createtableAddmoneynovara(tbAddmoneynovaras, tbDescriptionstatement.getSumAddmoneynovara());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRemunerationcommittee(tbRemunerationcommittees,
                tbDescriptionstatement.getSumRemunerationcomnittee());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaketimeformeal(tbMaketimeformeals, tbDescriptionstatement.getSumMaketimeformeals());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRentshouse(tbRentshouses, tbDescriptionstatement.getSumRentshouse());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableTeachextra(tbTeachextras, tbDescriptionstatement.getSumTeachextra());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableExpenpaper(tbExpenpapers, tbDescriptionstatement.getSumExpenpaper());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableComlecturer(tbComlecturers, tbDescriptionstatement.getSumComlecturer());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableOthercompensation(tbOthercompensations,
                tbDescriptionstatement.getSumOthercompensation());
        table.setSpacingBefore(25);
        document.add(table);

        createHeadlistBudwork(document, "2");

        table = createtableAllowancesrental(tbAllowancesrentals,
                tbDescriptionstatement.getSumAllowancesrental());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableGasolineDetail(tbGasolineDetails, tbDescriptionstatement.getSumGasoline());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRepairofequipment(tbRepairofequipments,
                tbDescriptionstatement.getSumRepairofequipment());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableWageservice(tbWageservices, tbDescriptionstatement.getSumWageservice());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMeetingofthesnack(tbMeetingofthesnacks,
                tbDescriptionstatement.getSumMeetingofthesnack());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableSocialsecurity(tbSocialsecuritys, tbDescriptionstatement.getSumSocialsecurity());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableRentalproperty(tbRentalpropertys, tbDescriptionstatement.getSumRentalproperty());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableThecertificationfood(tbThecertificationfoods,
                tbDescriptionstatement.getSumThecertificationfood());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableThecertificationdrinks(tbThecertificationdrinks,
                tbDescriptionstatement.getSumThecertificationdrink());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableThegift(tbThegifts, tbDescriptionstatement.getSumThegift());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableTax(tbTaxs, tbDescriptionstatement.getSumTax());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableFee(tbFees, tbDescriptionstatement.getSumFee());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableInsurance(tbInsurances, tbDescriptionstatement.getSumInsurance());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableEmploy(tbEmploys, tbDescriptionstatement.getSumEmploy());
        table.setSpacingBefore(25);
        document.add(table);

        createHeadlistBudwork(document, "3");

        table = createtableMaterial1(tbMaterials1, tbDescriptionstatement.getSumMOffice());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial2(tbMaterials2, tbDescriptionstatement.getSumMBuild());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial3(tbMaterials3, tbDescriptionstatement.getSumMKitchen());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial4(tbMaterials4, tbDescriptionstatement.getSumMElectrical());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial5(tbMaterials5, tbDescriptionstatement.getSumMMedic());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial6(tbMaterials6, tbDescriptionstatement.getSumMStudy());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial7(tbMaterials7, tbDescriptionstatement.getSumMBook());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial8(tbMaterials8, tbDescriptionstatement.getSumMFarm());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial9(tbMaterials9, tbDescriptionstatement.getSumMCom());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial10(tbMaterials10, tbDescriptionstatement.getSumMMul());
        table.setSpacingBefore(25);
        document.add(table);

        table = createtableMaterial11(tbMaterials11, tbDescriptionstatement.getSumMOther());
        table.setSpacingBefore(25);
        document.add(table);

        createHeadlistBudwork(document, "4");

        table = createtablePublicutility(tbPublicutilitys, tbDescriptionstatement.getSumPublicutility());
        table.setSpacingBefore(25);
        document.add(table);

        document.close();
    } catch (FileNotFoundException e) {

        e.printStackTrace();
    } catch (DocumentException e) {
        e.printStackTrace();
    }
    return document;
}

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

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

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

    String imagepath = "src/main/webapp/resources/images/curt.gif";
    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("FormProject ");

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

}

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

private static void createTable(Document document) throws DocumentException, IOException {
    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 .  c  o m

    Paragraph paragraph = new Paragraph();
    paragraph.setFont(font);
    creteEmptyLine(paragraph, 2);
    document.add(paragraph);
    PdfPTable table = new PdfPTable(7);

    paragraph.add("");

    PdfPCell c1 = new PdfPCell(new Phrase("asasas", font));

    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("/?", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("?", font));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    TbActivity ac = new TbActivity();

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

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

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

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

    paragraph.add("");

    for (int i = 0; i < 7; i++) {
        table.setWidthPercentage(100);
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(paragraph);

    }

    document.add(table);
}

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

private static void createPagePDFFormProject(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);/*  www . j av  a  2  s .c om*/
    int acNo = 0;

    Paragraph openning = new Paragraph();
    Paragraph ska = new Paragraph();
    Paragraph sms = new Paragraph();
    Paragraph notice = new Paragraph();
    Paragraph address = new Paragraph();
    Paragraph readyTodo = new Paragraph();

    readyTodo.setFont(font);
    address.setFont(font);
    ska.setFont(font);
    sms.setFont(font);
    notice.setFont(font);
    openning.setFont(font);
    openning.add("  : " + tbFormProject.getTbFaculty().getFacultyName());
    creteEmptyLine(openning, 1);
    openning.add("?"
            + tbFormProject.getTbStrBud().getStrBudName());
    creteEmptyLine(openning, 1);
    openning.add("?  : " + tbFormProject.getTbPlan().getPlansName());
    creteEmptyLine(openning, 1);
    openning.add("? : "
            + tbFormProject.getTbStrMin().getStrMinName());
    creteEmptyLine(openning, 1);
    openning.add("? : "
            + tbFormProject.getTbMisUni().getMisUniName());
    creteEmptyLine(openning, 1);
    openning.add(" : "
            + tbFormProject.getTbSubUni().getSubUniName());
    creteEmptyLine(openning, 1);
    openning.add("? : " + tbFormProject.getTbProduct().getProductName());
    creteEmptyLine(openning, 1);
    openning.add(
            "? : " + tbFormProject.getTbProjectname().getProjectnameName());
    creteEmptyLine(openning, 1);
    openning.add("? : "
            + tbFormProject.getTbPerson().getPersonName() + " "
            + tbFormProject.getTbPerson().getPersonLastname());
    creteEmptyLine(openning, 1);
    openning.add("  : " + tbFormProject.getTotal());
    creteEmptyLine(openning, 1);
    openning.add("? : "
            + tbFormProject.getAllocateMoney());
    creteEmptyLine(openning, 1);
    openning.add(" : "
            + (Long.parseLong(tbFormProject.getAllocateMoney())
                    - Long.parseLong(tbFormProject.getMoneyBalance())));
    creteEmptyLine(openning, 1);
    openning.add(" : " + tbFormProject.getMoneyBalance());

    creteLine(openning, 1);
    creteEmptyLine(openning, 1);
    for (TbActivity ac : activity) {
        acNo++;
        openning.add("??" + acNo + ":" + ac.getActivityName()
                + "?? : " + ac.getAddressName());
        creteEmptyLine(openning, 1);
        openning.add("?? : " + ac.getStartdate()
                + "?? : " + ac.getEnddate());
        creteEmptyLine(openning, 1);
        openning.add("? : "
                + ac.getAllocateMoney() + " : "
                + ac.getMoneyBalance());
        creteEmptyLine(openning, 1);
        openning.add(" : "
                + (Long.parseLong(ac.getAllocateMoney()) - Long.parseLong(ac.getMoneyBalance())));

        creteLine(openning, 1);
        creteEmptyLine(openning, 1);
    }
    ska.add("      ?? (?)");
    creteEmptyLine(ska, 1);
    for (TbDetailSka de : detailSka) {
        ska.add(de.getTbSkaType().getSkaTypeName() + "  : "
                + de.getTbSkaIndicatorsFac().getSkaIndicatorsFacName() + "  : "
                + de.getTbSkaIndicatorsHouse().getSkaIndicatorsHouseName());
        creteEmptyLine(ska, 1);
    }
    sms.add("      ??? ()");
    creteEmptyLine(sms, 1);
    for (TbDetailSm sm : detailSms) {
        sms.add(sm.getTbSmsCategory().getSmsCategoryName() + " " + "  "
                + sm.getTbSmsIndicator().getSmsIndicatorsName());
        creteEmptyLine(sms, 1);
    }

    notice.add(
            " : ???????  ?????? ");
    creteEmptyLine(notice, 1);

    address.add("? : " + " : "
            + subProject.getTbAmphur().getAmphurTh() + " : "
            + subProject.getTbProvince().getProvinceTh());
    creteEmptyLine(address, 1);

    readyTodo.add("?");
    creteEmptyLine(readyTodo, 1);
    readyTodo.add("? : "
            + subProject.getTbApproPlaceType().getApproPlaceTypeName());
    creteEmptyLine(readyTodo, 1);
    readyTodo.add("?/ : "
            + subProject.getTbApproPoint1().getApproPointName());
    creteEmptyLine(readyTodo, 1);
    readyTodo.add("/?  : "
            + subProject.getTbApproPoint2().getApproPointName());
    creteEmptyLine(readyTodo, 1);
    readyTodo.add("?? : "
            + subProject.getTbApproProjectType().getApproProjectTypeName());
    creteEmptyLine(readyTodo, 1);

    document.add(openning);
    document.add(ska);
    document.add(sms);
    document.add(notice);
    document.add(address);
    document.add(readyTodo);

}

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

public static PdfPTable createtableTargetGroup(TbTargetgroup targetGroup) throws DocumentException, Exception {

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

    PdfPTable table = new PdfPTable(3);
    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);

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutMana(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinMana(), font)));

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutTeach(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinTeach(), font)));

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutEmp(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinEmp(), font)));

    table.addCell(new PdfPCell(new Phrase("??", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutStu(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinStu(), font)));

    table.addCell(new PdfPCell(new Phrase("/?", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutCommu(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinCommu(), font)));

    table.addCell(
            new PdfPCell(new Phrase("?/?", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutDisable(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinDisable(), font)));

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutOther(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinOther(), font)));

    return table;
}

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

public static PdfPTable createtableTargetGroup2(TbTargetgroup targetGroup) 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(3);
    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);

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutMana(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActinMana(), font)));

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutTeach(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActinTeach(), font)));

    table.addCell(new PdfPCell(new Phrase("", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutEmp(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActinEmp(), font)));

    table.addCell(new PdfPCell(new Phrase("??", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutStu(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinStu(), font)));

    table.addCell(new PdfPCell(new Phrase("?", font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutLect(), font)));
    table.addCell(new PdfPCell(new Phrase(targetGroup.getActinLect(), font)));

    return table;

}