Example usage for com.itextpdf.text Font BOLD

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

Introduction

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

Prototype

int BOLD

To view the source code for com.itextpdf.text Font BOLD.

Click Source Link

Document

this is a possible style.

Usage

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

protected void printKeyData(SessionContainerWO sessionContainerWO) {
    try {/*from w ww .  j ava  2 s . c  om*/
        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 {/*from   w  w w. ja va2s  .  c  om*/
        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.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  w  w .j a v  a 2  s  .c o 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.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);
}

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

License:Open Source License

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

From source file:be.thomasmore.controller.PdfController.java

public void createPdfKlas() {

    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();/*from  www.  ja  va  2  s  . c  o m*/
    String KlasId = params.get("klasId");
    int id = Integer.parseInt(KlasId);
    Document document = new Document();
    Klas klas = service.getKlas(id);
    List<Klastest> klastesten = klas.getKlastestList();
    List<Test> testen = new ArrayList<Test>();

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
            .getResponse();
    res.setHeader("Content-Disposition", "attachement; filename=" + klas.getNummer() + "-resultaten.pdf");
    res.setContentType("application/pdf");

    try {
        PdfWriter.getInstance(document, res.getOutputStream());

        document.open();

        Font font = FontFactory.getFont("Calibri");
        Font fontbold = FontFactory.getFont("Calibri", Font.BOLD);

        PdfPTable table = new PdfPTable(3); // 3 columns.

        PdfPCell cell1 = new PdfPCell(new Paragraph("Vak", font));
        PdfPCell cell2 = new PdfPCell(new Paragraph("Student", font));
        PdfPCell cell3 = new PdfPCell(new Paragraph("Behaald", font));

        table.addCell(cell1);
        table.addCell(cell2);
        table.addCell(cell3);

        for (Klastest klastest : klastesten) {
            Test test = klastest.getTestId();
            testen.add(service.getTest(test.getId()));
        }

        for (Test test : testen) {
            List<Score> scores = test.getScoreList();
            Vak vak = test.getVakId();
            for (Score score : scores) {
                Student student = score.getStudentId();
                PdfPCell cellVak = new PdfPCell(new Paragraph(vak.getNaam(), font));
                PdfPCell cellStudent = new PdfPCell(new Paragraph(student.getVoornaam(), font));
                PdfPCell cellScore = new PdfPCell(new Paragraph(score.getScore().toString(), font));

                table.addCell(cellVak);
                table.addCell(cellStudent);
                table.addCell(cellScore);
            }
        }

        document.add(new Phrase("Klas: ", font));
        document.add(new Phrase(klas.getNummer(), font));
        document.add(table);

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

    }

}

From source file:be.thomasmore.controller.PdfController.java

public void createPdfTest() {
    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();/*from  w  w  w.  j  a va 2 s.co  m*/
    String KlasId = params.get("klasId3");
    String TestId = params.get("testId");
    int klasId = Integer.parseInt(KlasId);
    int id = Integer.parseInt(TestId);
    Document document = new Document();
    Test test = service.getTest(id);
    List<Score> scores = test.getScoreList();
    Klas klas = service.getKlas(klasId);
    Vak vak = test.getVakId();

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
            .getResponse();
    res.setHeader("Content-Disposition", "attachement; filename=" + test.getBeschrijving() + "-resultaten.pdf");
    res.setContentType("application/pdf");

    try {
        PdfWriter.getInstance(document, res.getOutputStream());

        document.open();

        Font font = FontFactory.getFont("Calibri");
        Font fontbold = FontFactory.getFont("Calibri", Font.BOLD);

        PdfPTable table = new PdfPTable(3); // 3 columns.

        PdfPCell cell1 = new PdfPCell(new Paragraph("Test", font));
        PdfPCell cell2 = new PdfPCell(new Paragraph("Student", font));
        PdfPCell cell3 = new PdfPCell(new Paragraph("Score", font));

        table.addCell(cell1);
        table.addCell(cell2);
        table.addCell(cell3);

        for (Score score : scores) {
            Student student = score.getStudentId();
            PdfPCell cellTest = new PdfPCell(new Paragraph(test.getBeschrijving(), font));
            PdfPCell cellStudent = new PdfPCell(new Paragraph(student.getVoornaam(), font));
            PdfPCell cellScore = new PdfPCell(new Paragraph(score.getScore().toString()));

            table.addCell(cellTest);
            table.addCell(cellStudent);
            table.addCell(cellScore);
        }

        document.add(new Phrase("Klas: ", font));
        document.add(new Phrase(klas.getNummer(), font));
        document.add(new Phrase("  Vak: ", font));
        document.add(new Phrase(vak.getNaam(), font));
        document.add(table);

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

    }

}

From source file:be.thomasmore.controller.PdfController.java

public void createPdfVak() {
    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();/*from  w w  w. j  a  va 2s . c o  m*/
    String KlasId = params.get("klasId2");
    String VakId = params.get("vakId");
    int klasId = Integer.parseInt(KlasId);
    int id = Integer.parseInt(VakId);
    Document document = new Document();
    Vak vak = service.getVak(id);
    List<Test> testen = vak.getTestList();
    Klas klas = service.getKlas(klasId);

    HttpServletResponse res = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext()
            .getResponse();
    res.setHeader("Content-Disposition", "attachement; filename=" + vak.getNaam() + "-resultaten.pdf");
    res.setContentType("application/pdf");

    try {
        PdfWriter.getInstance(document, res.getOutputStream());

        document.open();

        Font font = FontFactory.getFont("Calibri");
        Font fontbold = FontFactory.getFont("Calibri", Font.BOLD);

        PdfPTable table = new PdfPTable(3); // 3 columns.

        PdfPCell cell1 = new PdfPCell(new Paragraph("Test", font));
        PdfPCell cell2 = new PdfPCell(new Paragraph("Student", font));
        PdfPCell cell3 = new PdfPCell(new Paragraph("Score", font));

        table.addCell(cell1);
        table.addCell(cell2);
        table.addCell(cell3);

        for (Test test : testen) {
            List<Score> scores = test.getScoreList();
            for (Score score : scores) {
                Student student = score.getStudentId();
                PdfPCell cellTest = new PdfPCell(new Paragraph(test.getBeschrijving(), font));
                PdfPCell cellStudent = new PdfPCell(new Paragraph(student.getVoornaam(), font));
                PdfPCell cellScore = new PdfPCell(new Paragraph(score.getScore().toString()));

                table.addCell(cellTest);
                table.addCell(cellStudent);
                table.addCell(cellScore);
            }
        }

        document.add(new Phrase("Klas: ", font));
        document.add(new Phrase(klas.getNummer(), font));
        document.add(new Phrase("  Vak: ", font));
        document.add(new Phrase(vak.getNaam(), font));
        document.add(table);

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

    }
}