use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.
the class CustomTableManager method getPhraseCellLeft.
@Override
public PdfPCell getPhraseCellLeft(String content) {
PdfPCell c = new PdfPCell(new Phrase(ReportUtil.convertEncode(content), fontManager.getDefaultFont()));
c.setLeading(12f, 0);
c.setPadding(5);
c.setHorizontalAlignment(Element.ALIGN_LEFT);
c.setVerticalAlignment(Element.ALIGN_MIDDLE);
return c;
}
use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.
the class CustomTableManager method getHeaderCell.
@Override
public PdfPCell getHeaderCell(String title) {
PdfPCell header = new PdfPCell(new Phrase(ReportUtil.convertEncode(title), fontManager.getDefaultFont()));
header.setHorizontalAlignment(Element.ALIGN_CENTER);
header.setVerticalAlignment(Element.ALIGN_MIDDLE);
return header;
}
use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.
the class TCAPageFooter method onEndPage.
@Override
public void onEndPage(PdfWriter writer, Document document) {
PdfPTable table = new PdfPTable(3);
try {
table.setWidths(new int[] { 20, 80, 20 });
table.setTotalWidth(527);
table.setLockedWidth(true);
table.getDefaultCell().setFixedHeight(20);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
String anexo = "";
if (writer.getPageNumber() >= 8 && writer.getPageNumber() <= 11) {
anexo = "Anexo A - Relação de cursos previstos";
} else if (writer.getPageNumber() >= 8 && writer.getPageNumber() <= 224) {
anexo = "Anexo B - Folha de Rosto dos Cursos Previstos";
} else if (writer.getPageNumber() == 225) {
anexo = "Anexo C - Modelo de Ficha de Indicação CNS014";
}
if (writer.getPageNumber() % 2 != 0) {
table.addCell(new Phrase(header, new Font(Font.FontFamily.HELVETICA, 10)));
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
PdfPCell anexoCell = new PdfPCell(new Phrase(String.format(anexo, writer.getPageNumber()), new Font(Font.FontFamily.HELVETICA, 10)));
anexoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
anexoCell.setBorder(Rectangle.NO_BORDER);
table.addCell(anexo);
table.addCell(new Phrase(String.format("%d", writer.getPageNumber()), new Font(Font.FontFamily.HELVETICA, 10)));
} else {
table.addCell(new Phrase(String.format("%d", writer.getPageNumber()), new Font(Font.FontFamily.HELVETICA, 10)));
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
PdfPCell anexoCell = new PdfPCell(new Phrase(String.format(anexo, writer.getPageNumber()), new Font(Font.FontFamily.HELVETICA, 10)));
anexoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
anexoCell.setBorder(Rectangle.NO_BORDER);
table.addCell(anexo);
table.addCell(new Phrase(header, new Font(Font.FontFamily.HELVETICA, 10)));
// table.getDefaultCell().setHorizontalAlignment(
// Element.ALIGN_RIGHT);
}
PdfPCell cell = new PdfPCell(Image.getInstance(total));
cell.setBorder(Rectangle.NO_BORDER);
// table.addCell(cell);
table.writeSelectedRows(0, -1, 34, 803, writer.getDirectContent());
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
}
use of com.itextpdf.text.Phrase in project saga by timurstrekalov.
the class PdfReporter method createFooter.
private Element createFooter() {
final Paragraph footer = new Paragraph();
footer.add(new Phrase("Generated using ", FONT_FOOTER));
final Anchor a = new Anchor(config.getProperty("app.name"), FONT_FOOTER);
a.setReference("http://timurstrekalov.github.com/saga/");
footer.add(a);
footer.add(new Phrase(" version " + config.getProperty("app.version"), FONT_FOOTER));
footer.setAlignment(Element.ALIGN_RIGHT);
return footer;
}
use of com.itextpdf.text.Phrase 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));
}
}
Aggregations