Example usage for com.itextpdf.text FontFactory getFont

List of usage examples for com.itextpdf.text FontFactory getFont

Introduction

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

Prototype


public static Font getFont(final String fontname, final float size, final int style) 

Source Link

Document

Constructs a Font-object.

Usage

From source file:be.mxs.common.util.pdf.general.chuk.GeneralPDFCreator.java

protected void printKeyData(SessionContainerWO sessionContainerWO) {
    try {/*from   w  w  w  .j  av  a  2  s.  c o m*/
        doc.add(new Paragraph(" "));
        table = new PdfPTable(15);
        table.setWidthPercentage(100);

        // kernel-data
        cell = new PdfPCell(new Paragraph(getTran("Web.Occup", "medwan.common.kernel-data").toUpperCase(),
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0),
                        Font.ITALIC)));
        cell.setColspan(15);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
        table.addCell(cell);

        // row 1 : last-periodical-examination
        Paragraph par = new Paragraph(
                getTran("Web.Occup", "medwan.common.last-periodical-examination").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        TransactionVO tran = sessionContainerWO.getLastTransaction(IConstants_PREFIX + "TRANSACTION_TYPE_MER");
        ItemVO item;
        if (tran != null) {
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_MER_EXAMINATION_DATE");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }
        cell = new PdfPCell(par);
        cell.setColspan(5);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 1 : next-periodical-examination
        par = new Paragraph(
                getTran("Web.Occup", "medwan.common.next-periodical-examination").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        if (sessionContainerWO.getFlags().getLastExaminationReport() != null && sessionContainerWO.getFlags()
                .getLastExaminationReport().getNewExaminationDueDate() != null) {
            par.add(new Chunk(
                    dateFormat.format(sessionContainerWO.getFlags().getLastExaminationReport()
                            .getNewExaminationDueDate()),
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        }
        cell = new PdfPCell(par);
        cell.setColspan(5);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 1 : next-driver-examination / Volgend onderzoek medische schifting
        par = new Paragraph(getTran("Web.Occup", "medwan.common.next-driver-examination").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        if (sessionContainerWO.getFlags().getLastDrivingCertificate() != null) {

            // CBMT only : only display newExaminationDueDate if patient has riskcode "070" (drivinglicense)
            boolean riskCode070Found = false;

            if (riskCode070Found) {
                String newExamDueDateMinus = ScreenHelper.checkString(sessionContainerWO.getFlags()
                        .getLastDrivingCertificate().getNewExaminationDueDateMinus());
                if (newExamDueDateMinus.length() > 0) {
                    par.add(new Chunk(newExamDueDateMinus.replaceAll("-", "/"),
                            FontFactory.getFont(FontFactory.HELVETICA,
                                    Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
                }
            }
        } else {
            // no data available
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.no-data"), FontFactory.getFont(
                    FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        }

        cell = new PdfPCell(par);
        cell.setColspan(5);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Biometrie
        par = new Paragraph(getTran("Web.Occup", "medwan.common.biometry").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeBiometry();
        if (tran != null) {
            // height
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_BIOMETRY_HEIGHT");
            String sHeight = "", sWeight = "";
            if (item != null) {
                sHeight = item.getValue();
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.length") + ": " + sHeight + " cm\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }

            // weight
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_BIOMETRY_WEIGHT");
            if (item != null) {
                sWeight = item.getValue();
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.weight") + ": " + sWeight + " kg\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }

            // BMI
            if (sWeight.length() > 0 && sHeight.length() > 0) {
                try {
                    DecimalFormat deci = new DecimalFormat("0.0");
                    Float bmi = new Float(Float.parseFloat(sWeight.replaceAll(",", ".")) * 10000
                            / (Float.parseFloat(sHeight.replaceAll(",", "."))
                                    * Float.parseFloat(sHeight.replaceAll(",", "."))));
                    par.add(new Chunk("BMI: " + deci.format(bmi), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }

        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Urineonderzoek
        par = new Paragraph("URINE\n", FontFactory.getFont(FontFactory.HELVETICA,
                Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeUrineExamination();
        if (tran != null) {
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_ALBUMINE");
            if (item != null) {
                par.add(new Chunk("Albumine: " + getTran("Web.Occup", item.getValue()) + "\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_GLUCOSE");
            if (item != null) {
                par.add(new Chunk("Glucose: " + getTran("Web.Occup", item.getValue()) + "\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_BLOOD");
            if (item != null) {
                par.add(new Chunk(
                        getTran("Web.Occup", "medwan.common.blood") + ": "
                                + getTran("Web.Occup", item.getValue()),
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }

        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Audiometrie
        par = new Paragraph(getTran("Web.Occup", "medwan.common.audiometry").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeAudiometry();
        if (tran != null) {
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.mean-hearing-loss").toUpperCase() + "\n",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 6 * fontSizePercentage / 100.0), Font.ITALIC)));
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_AUDIOMETRY_RIGHT_LOSS");
            if (item != null) {
                par.add(new Chunk(
                        getTran("Web.Occup", "medwan.common.right") + ": -" + item.getValue() + " dB\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_AUDIOMETRY_LEFT_LOSS");
            if (item != null) {
                par.add(new Chunk(
                        getTran("Web.Occup", "medwan.common.left") + ": -" + item.getValue() + " dB\n",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }
        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Visus
        par = new Paragraph(
                getTran("Web.Occup", "medwan.common.vision").toUpperCase() + " - "
                        + getTran("Web.Occup",
                                IConstants_PREFIX + "item_type_opthalmology_screen_visiotest_vision_far")
                                        .toUpperCase()
                        + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeOphtalmology();
        if (tran != null) {
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.right-left-binocular").toUpperCase() + "\n",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 6 * fontSizePercentage / 100.0), Font.ITALIC)));
            par.add(new Chunk(getTran("Web.Occup", "medwan.common.without-correction") + ": ",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OD_WITHOUT_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OG_WITHOUT_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_BONI_WITHOUT_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("\n" + getTran("Web.Occup", "medwan.common.with-correction") + ": ",
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OD_WITH_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OG_WITH_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
            par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                    Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));

            item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_BONI_WITH_GLASSES");
            if (item != null) {
                par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }
        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        // row 2 : Bloeddruk
        par = new Paragraph(getTran("Web.Occup", "medwan.common.blood-pressure").toUpperCase() + "\n",
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0),
                        Font.ITALIC));
        tran = sessionContainerWO.getLastTransactionTypeGeneralClinicalExamination();
        if (tran != null) {
            // right
            ItemVO item1 = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_SYSTOLIC_PRESSURE_RIGHT");
            item = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_DIASTOLIC_PRESSURE_RIGHT");
            if (item1 != null || item != null) {
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.right") + ": ",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                if (item1 != null) {
                    par.add(new Chunk(item1.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));
                if (item != null) {
                    par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk(" mmHg\n", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }

            // left
            item = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_SYSTOLIC_PRESSURE_LEFT");
            item1 = tran.getItem(
                    IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_DIASTOLIC_PRESSURE_LEFT");
            if (item != null || item1 != null) {
                par.add(new Chunk(getTran("Web.Occup", "medwan.common.left") + ": ",
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                if (item != null) {
                    par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));
                if (item1 != null) {
                    par.add(new Chunk(item1.getValue(), FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
                }
                par.add(new Chunk(" mmHg\n", FontFactory.getFont(FontFactory.HELVETICA,
                        Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
            }
        }

        cell = new PdfPCell(par);
        cell.setColspan(3);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        table.addCell(cell);

        doc.add(table);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:be.mxs.common.util.pdf.general.chuk.GeneralPDFCreator.java

protected void printAdminHeader(AdminPerson activePerson) {
    try {//  ww w  . j a  v  a2  s  .co  m
        doc.add(new Paragraph(" "));
        table = new PdfPTable(4);
        table.setWidthPercentage(100);

        // title
        cell = new PdfPCell(
                new Paragraph(getTran("Web.Occup", "medwan.common.administrative-data").toUpperCase(),
                        FontFactory.getFont(FontFactory.HELVETICA,
                                Math.round((double) 8 * fontSizePercentage / 100.0), Font.ITALIC)));
        cell.setColspan(4);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
        table.addCell(cell);

        // firstname
        cell = new PdfPCell(new Paragraph(activePerson.firstname + " " + activePerson.lastname,
                FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0),
                        Font.BOLD)));
        cell.setColspan(2);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);

        // dateOfBirth
        cell = new PdfPCell(new Paragraph("" + activePerson.dateOfBirth, FontFactory.getFont(
                FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        cell.setColspan(1);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);

        // gender
        cell = new PdfPCell(new Paragraph(activePerson.gender + "", FontFactory.getFont(FontFactory.HELVETICA,
                Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD)));
        cell.setColspan(1);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(BaseColor.LIGHT_GRAY);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);

        // address
        AdminPrivateContact contact = activePerson.getActivePrivate();
        if (contact != null) {
            cell = new PdfPCell(new Paragraph(
                    contact.district + " - "
                            + ScreenHelper.getTran(null, "province", contact.province, sPrintLanguage),
                    FontFactory.getFont(FontFactory.HELVETICA,
                            Math.round((double) 8 * fontSizePercentage / 100.0), Font.NORMAL)));
            cell.setColspan(4);
            cell.setBorder(PdfPCell.BOX);
            cell.setBorderColor(BaseColor.LIGHT_GRAY);
            cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
            table.addCell(cell);
        }

        doc.add(table);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

private void addDisciplinaryRecordDetails(PdfPTable table, DisciplinaryRecord disRec) {
    if (disRec.followUp.length() > 0) {
        PdfPTable detailsTable = new PdfPTable(10);
        detailsTable.setWidthPercentage(100);

        // follow-up in grey and italic
        //detailsTable.addCell(createValueCell(disRec.followUp.replaceAll("\r\n"," "),10));
        Font font = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.ITALIC);
        font.setColor(BaseColor.GRAY);//from w w w.  j av  a  2s  .co m
        cell = new PdfPCell(new Paragraph(disRec.followUp.replaceAll("\r\n", " "), font));
        cell.setColspan(10);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(innerBorderColor);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        detailsTable.addCell(cell);

        table.addCell(createCell(new PdfPCell(detailsTable), table.getNumberOfColumns(), PdfPCell.ALIGN_CENTER,
                PdfPCell.BOX));
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

private void addLeaveDetails(PdfPTable table, Leave leave) {
    if (leave.comment.length() > 0) {
        PdfPTable detailsTable = new PdfPTable(10);
        detailsTable.setWidthPercentage(100);

        // follow-up in grey and italic
        //detailsTable.addCell(createValueCell(leave.comment.replaceAll("\r\n"," "),10));
        Font font = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.ITALIC);
        font.setColor(BaseColor.GRAY);/*from  ww  w .  ja  v a  2s . c om*/
        cell = new PdfPCell(new Paragraph(leave.comment.replaceAll("\r\n", " "), font));
        cell.setColspan(10);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(innerBorderColor);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        detailsTable.addCell(cell);

        table.addCell(createCell(new PdfPCell(detailsTable), table.getNumberOfColumns(), PdfPCell.ALIGN_CENTER,
                PdfPCell.BOX));
    }
}

From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java

private void addCareerDetails(PdfPTable table, Career career) {
    if (career.comment.length() > 0) {
        PdfPTable detailsTable = new PdfPTable(10);
        detailsTable.setWidthPercentage(100);

        // comment in grey and italic
        //detailsTable.addCell(createValueCell(career.comment.replaceAll("\r\n"," "),10));
        Font font = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.ITALIC);
        font.setColor(BaseColor.GRAY);/*from   www. j  av a2 s  . com*/
        cell = new PdfPCell(new Paragraph(career.comment.replaceAll("\r\n", " "), font));
        cell.setColspan(10);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(innerBorderColor);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        detailsTable.addCell(cell);

        table.addCell(createCell(new PdfPCell(detailsTable), table.getNumberOfColumns(), PdfPCell.ALIGN_CENTER,
                PdfPCell.BOX));
    }
}

From source file:be.mxs.common.util.pdf.general.oc.examinations.PDFDrivingLicenseDeclaration.java

private void addQuestionnaire() {
    if (isAtLeastOneQuestionAnswered()) {
        contentTable = new PdfPTable(1);
        table = new PdfPTable(5);

        PdfPTable questions = new PdfPTable(40);

        // header
        questions.addCell(createTitleCell(
                getTran("medwan.common.driving-license-declaration.candidate-questionnaire"), 40));

        // questions
        String questionPrefix = "medwan.common.driving-license-declaration.candidate-questionnaire.question-";
        for (int i = 1; i <= 20; i++) {
            questions = addQuestion(questions, i, getTran(questionPrefix + i),
                    IConstants_PREFIX + "ITEM_TYPE_DLD_Q" + i);
        }/*from w ww .j  a  v a2s.co m*/

        // commitment
        String commPart1 = getTran(
                "medwan.common.driving-license-declaration.candidate-questionnaire.commitment") + " ";
        String commPart2 = getTran(
                "medwan.common.driving-license-declaration.candidate-questionnaire.commitment1");

        cell = new PdfPCell(new Phrase(commPart1 + commPart2, FontFactory.getFont(FontFactory.HELVETICA,
                Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD)));
        cell.setColspan(40);
        cell.setBorder(PdfPCell.BOX);
        cell.setBorderColor(innerBorderColor);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        questions.addCell(cell);

        // add content to document
        if (questions.size() > 0) {
            contentTable
                    .addCell(createCell(new PdfPCell(questions), 1, PdfPCell.ALIGN_CENTER, PdfPCell.NO_BORDER));
            tranTable.addCell(createContentCell(contentTable));
        }
    }
}

From source file:be.mxs.common.util.pdf.general.oc.examinations.PDFDrivingLicenseDeclaration.java

private PdfPTable addQuestion(PdfPTable table, int id, String question, String answer) {
    // cel 1 : nr
    cell = new PdfPCell(new Phrase(id + "", FontFactory.getFont(FontFactory.HELVETICA,
            Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));
    cell.setColspan(1);// w ww.  j a va2  s  . c om
    cell.setBorder(PdfPCell.BOX);
    cell.setBorderColor(innerBorderColor);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    // cel 2-38 : question
    cell = new PdfPCell(new Phrase(question, FontFactory.getFont(FontFactory.HELVETICA,
            Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));
    cell.setColspan(37);
    cell.setBorder(PdfPCell.BOX);
    cell.setBorderColor(innerBorderColor);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    // cel 39 and 40 : answer
    cell = new PdfPCell(new Phrase(getTran(getItemValue(answer)), FontFactory.getFont(FontFactory.HELVETICA,
            Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL)));
    cell.setColspan(2);
    cell.setBorder(PdfPCell.BOX);
    cell.setBorderColor(innerBorderColor);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    return table;
}

From source file:be.rheynaerde.poolsheets.configuration.defaultconfiguration.DefaultAbstractPoolSheetConfiguration.java

License:Open Source License

public Font getTitleFont() {
    return FontFactory.getFont("helvetica", 32f, Font.BOLD);
}

From source file:be.rheynaerde.poolsheets.configuration.defaultconfiguration.DefaultAbstractPoolSheetConfiguration.java

License:Open Source License

public Font getSubtitleFont() {
    return FontFactory.getFont("helvetica", 24f, Font.BOLD);
}

From source file:be.rheynaerde.poolsheets.configuration.defaultconfiguration.DefaultAbstractPoolSheetConfiguration.java

License:Open Source License

public Font getHeaderFont() {
    return FontFactory.getFont("helvetica", 12f, Font.BOLD);
}