Search in sources :

Example 1 with Font

use of com.itextpdf.text.Font in project bamboobsc by billchen198318.

the class OrganizationReportPdfCommand method getFont.

private Font getFont(String color, boolean bold) throws Exception {
    Font font = FontFactory.getFont(BscConstants.PDF_ITEXT_FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    int[] rgb = SimpleUtils.getColorRGB2(color);
    BaseColor baseColor = new BaseColor(rgb[0], rgb[1], rgb[2]);
    font.setSize(9);
    font.setColor(baseColor);
    return font;
}
Also used : BaseColor(com.itextpdf.text.BaseColor) BaseFont(com.itextpdf.text.pdf.BaseFont) Font(com.itextpdf.text.Font)

Example 2 with Font

use of com.itextpdf.text.Font in project saga by timurstrekalov.

the class PdfReporter method addFileStatsRows.

private void addFileStatsRows(final TestRunCoverageStatistics runStats, final PdfPTable table) {
    final List<ScriptCoverageStatistics> allFileStats = runStats.getFileStats();
    for (int i = 0; i < allFileStats.size(); i++) {
        final ScriptCoverageStatistics scriptCoverageStatistics = allFileStats.get(i);
        final boolean hasStatements = scriptCoverageStatistics.getHasStatements();
        final Phrase fileName = new Phrase();
        if (scriptCoverageStatistics.getParentName() != null) {
            fileName.add(new Chunk(scriptCoverageStatistics.getParentName() + "/", hasStatements ? FONT_TD : FONT_TD_EMPTY_FILE));
            fileName.add(new Chunk(scriptCoverageStatistics.getFileName(), hasStatements ? FONT_TD_BOLD : FONT_TD_BOLD_EMPTY_FILE));
        } else {
            fileName.add(new Chunk(scriptCoverageStatistics.getFileName(), hasStatements ? FONT_TD : FONT_TD_EMPTY_FILE));
        }
        final BaseColor bgColor = (i % 2 == 1) ? COLOR_ROW_ODD : COLOR_ROW_EVEN;
        final Font font = FONT_TD;
        table.addCell(createCell(fileName, 0, bgColor));
        table.addCell(createCell(String.valueOf(scriptCoverageStatistics.getStatements()), font, 1, bgColor));
        table.addCell(createCell(String.valueOf(scriptCoverageStatistics.getExecuted()), font, 2, bgColor));
        table.addCell(createCell(scriptCoverageStatistics.getCoverage() + "%", FONT_TD, 3, bgColor));
    }
}
Also used : BaseColor(com.itextpdf.text.BaseColor) Phrase(com.itextpdf.text.Phrase) Chunk(com.itextpdf.text.Chunk) Font(com.itextpdf.text.Font) ScriptCoverageStatistics(com.github.timurstrekalov.saga.core.model.ScriptCoverageStatistics)

Example 3 with Font

use of com.itextpdf.text.Font in project bamboobsc by billchen198318.

the class KpiReportPdfCommand method getFont.

private Font getFont(String color, boolean bold) throws Exception {
    Font font = FontFactory.getFont(BscConstants.PDF_ITEXT_FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    int[] rgb = SimpleUtils.getColorRGB2(color);
    BaseColor baseColor = new BaseColor(rgb[0], rgb[1], rgb[2]);
    font.setSize(9);
    if (bold) {
        font.setSize(14);
        font.setStyle(Font.BOLD);
    }
    font.setColor(baseColor);
    return font;
}
Also used : BaseColor(com.itextpdf.text.BaseColor) BaseFont(com.itextpdf.text.pdf.BaseFont) Font(com.itextpdf.text.Font)

Example 4 with Font

use of com.itextpdf.text.Font in project bamboobsc by billchen198318.

the class PersonalReportPdfCommand method getFont.

private Font getFont(String color, boolean bold) throws Exception {
    Font font = FontFactory.getFont(BscConstants.PDF_ITEXT_FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    int[] rgb = SimpleUtils.getColorRGB2(color);
    BaseColor baseColor = new BaseColor(rgb[0], rgb[1], rgb[2]);
    font.setSize(9);
    font.setColor(baseColor);
    return font;
}
Also used : BaseColor(com.itextpdf.text.BaseColor) BaseFont(com.itextpdf.text.pdf.BaseFont) Font(com.itextpdf.text.Font)

Aggregations

BaseColor (com.itextpdf.text.BaseColor)4 Font (com.itextpdf.text.Font)4 BaseFont (com.itextpdf.text.pdf.BaseFont)3 ScriptCoverageStatistics (com.github.timurstrekalov.saga.core.model.ScriptCoverageStatistics)1 Chunk (com.itextpdf.text.Chunk)1 Phrase (com.itextpdf.text.Phrase)1