use of com.itextpdf.text.pdf.PdfPTable in project trainning by fernandotomasio.
the class TCATrainningDocument method createAnexo1.
private void createAnexo1(Map<Long, CursoDTO> cursosMap) {
// ReportUtil.getCursos(cursosMap);
List<CursoDTO> cursos = null;
try {
PdfPTable t = new PdfPTable(2);
t.setWidthPercentage(100);
t.setWidths(new int[] { 35, 200 });
for (CursoDTO curso : cursos) {
if (curso == null) {
continue;
}
PdfPCell cell = tableManager.getPhraseCellLeft(curso.getCodigo());
cell.setPadding(5);
cell.setBorder(Rectangle.NO_BORDER);
t.addCell(cell);
PdfPCell cell2 = tableManager.getPhraseCellLeft(curso.getDescricao());
cell2.setPadding(5);
cell2.setBorder(Rectangle.NO_BORDER);
t.addCell(cell2);
Paragraph p = null;
p = new Paragraph(ReportUtil.convertEncode(curso.getCodigo()) + " - " + ReportUtil.convertEncode(curso.getDescricao()), fontManager.getDefaultFont());
p.setAlignment(Element.ALIGN_LEFT);
// document.add(p);
}
document.add(t);
document.newPage();
} catch (DocumentException ex) {
Logger.getLogger(TCATrainningDocument.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of com.itextpdf.text.pdf.PdfPTable in project saga by timurstrekalov.
the class PdfReporter method createTable.
private PdfPTable createTable(final TestRunCoverageStatistics runStats) throws DocumentException {
final PdfPTable table = new PdfPTable(4);
table.setSpacingBefore(10);
table.setSpacingAfter(10);
table.setWidthPercentage(100);
table.setHeaderRows(1);
table.setWidths(new int[] { 70, 10, 10, 10 });
addHeader(table);
addTotalRow(runStats, table);
addFileStatsRows(runStats, table);
return table;
}
use of com.itextpdf.text.pdf.PdfPTable in project bamboobsc by billchen198318.
the class OrganizationReportPdfCommand method createPdf.
private String createPdf(Context context) throws Exception {
BscReportPropertyUtils.loadData();
String visionOid = (String) context.get("visionOid");
VisionVO vision = null;
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
for (VisionVO visionObj : treeObj.getVisions()) {
if (visionObj.getOid().equals(visionOid)) {
vision = visionObj;
}
}
FontFactory.register(BscConstants.PDF_ITEXT_FONT);
String fileName = UUID.randomUUID().toString() + ".pdf";
String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;
OutputStream os = new FileOutputStream(fileFullPath);
Document document = new Document(PageSize.A4.rotate(), 10, 10, 10, 10);
document.left(100f);
document.top(150f);
PdfWriter writer = PdfWriter.getInstance(document, os);
document.open();
PdfPTable table = new PdfPTable(MAX_COLSPAN);
table.setWidthPercentage(100f);
PdfPTable signTable = new PdfPTable(1);
signTable.setWidthPercentage(100f);
this.createHead(table, vision, context);
this.createBody(table, vision);
this.putSignature(signTable, context);
document.add(table);
document.add(signTable);
document.close();
writer.close();
os.flush();
os.close();
os = null;
File file = new File(fileFullPath);
String oid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "department-report.pdf");
file = null;
return oid;
}
use of com.itextpdf.text.pdf.PdfPTable in project bamboobsc by billchen198318.
the class PersonalReportPdfCommand method createPdf.
private String createPdf(Context context) throws Exception {
BscReportPropertyUtils.loadData();
String visionOid = (String) context.get("visionOid");
VisionVO vision = null;
BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
for (VisionVO visionObj : treeObj.getVisions()) {
if (visionObj.getOid().equals(visionOid)) {
vision = visionObj;
}
}
FontFactory.register(BscConstants.PDF_ITEXT_FONT);
String fileName = UUID.randomUUID().toString() + ".pdf";
String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;
OutputStream os = new FileOutputStream(fileFullPath);
Document document = new Document(PageSize.A4.rotate(), 10, 10, 10, 10);
document.left(100f);
document.top(150f);
PdfWriter writer = PdfWriter.getInstance(document, os);
document.open();
PdfPTable table = new PdfPTable(MAX_COLSPAN);
table.setWidthPercentage(100f);
PdfPTable signTable = new PdfPTable(1);
signTable.setWidthPercentage(100f);
this.createHead(table, vision, context);
this.createBody(table, vision);
this.createFoot(table, context);
this.putSignature(signTable, context);
document.add(table);
document.add(signTable);
document.close();
writer.close();
os.flush();
os.close();
os = null;
File file = new File(fileFullPath);
String oid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "personal-report.pdf");
file = null;
return oid;
}
use of com.itextpdf.text.pdf.PdfPTable in project trainning by fernandotomasio.
the class DOC002PDF method buildTableDisciplina.
private PdfPTable buildTableDisciplina(DisciplinaDTO disciplina) throws DocumentException {
PdfPTable table = new PdfPTable(6);
table.setWidthPercentage(100);
// table.setWidths(new int[]{2, 1, 1});
PdfPCell cellCampo;
Phrase phraseCampo = new Phrase();
phraseCampo.add(new Chunk("CAMPO: ", fontManager.getBoldFont()));
phraseCampo.add(new Chunk("TÉCNICO-ESPECIALIZADO", fontManager.getDefaultFont()));
cellCampo = new PdfPCell(phraseCampo);
cellCampo.setColspan(3);
cellCampo.setPadding(10);
table.addCell(cellCampo);
PdfPCell cellArea;
Phrase phraseArea = new Phrase();
phraseArea.add(new Chunk("ÁREA: ", fontManager.getBoldFont()));
phraseArea.add(new Chunk("SISTEMAS AEROESPACIAIS", fontManager.getDefaultFont()));
cellArea = new PdfPCell(phraseArea);
cellArea.setColspan(3);
cellArea.setPadding(10);
table.addCell(cellArea);
PdfPCell cellDescricao;
Phrase phraseDescricao = new Phrase();
phraseDescricao.add(new Chunk("DISCIPLINA " + disciplina.getNumeroDisciplina() + ": ", fontManager.getBoldFont()));
phraseDescricao.add(new Chunk(disciplina.getDescricao().toUpperCase(), fontManager.getDefaultFont()));
cellDescricao = new PdfPCell(phraseDescricao);
cellDescricao.setColspan(6);
cellDescricao.setPadding(10);
table.addCell(cellDescricao);
PdfPCell cellCHInstrucao;
Phrase phraseCHInstrucao = new Phrase();
phraseCHInstrucao.add(new Chunk("CH INSTRUÇÃO: ", fontManager.getBoldFont()));
phraseCHInstrucao.add(new Chunk(disciplina.getQuantidadeTemposAula() + " tempo(s)", fontManager.getDefaultFont()));
cellCHInstrucao = new PdfPCell(phraseCHInstrucao);
cellCHInstrucao.setColspan(2);
cellCHInstrucao.setPadding(10);
table.addCell(cellCHInstrucao);
PdfPCell cellCHAvaliacao;
Phrase phraseCHAvaliacao = new Phrase();
phraseCHAvaliacao.add(new Chunk("CH AVALIAÇÃO: ", fontManager.getBoldFont()));
phraseCHAvaliacao.add(new Chunk(disciplina.getQuantidadeTemposAvaliacao() + " tempo(s)", fontManager.getDefaultFont()));
cellCHAvaliacao = new PdfPCell(phraseCHAvaliacao);
cellCHAvaliacao.setColspan(2);
cellCHAvaliacao.setPadding(10);
table.addCell(cellCHAvaliacao);
PdfPCell cellCHTotal;
Phrase phraseCHTotal = new Phrase();
int quantidadeTempoTotal = disciplina.getQuantidadeTemposAula() + disciplina.getQuantidadeTemposAvaliacao();
phraseCHTotal.add(new Chunk("CH TOTAL: ", fontManager.getBoldFont()));
phraseCHTotal.add(new Chunk(quantidadeTempoTotal + " tempo(s)", fontManager.getDefaultFont()));
cellCHTotal = new PdfPCell(phraseCHTotal);
cellCHTotal.setColspan(2);
cellCHTotal.setPadding(10);
table.addCell(cellCHTotal);
PdfPCell cellObjetivos;
Paragraph objetivosHead = new Paragraph("OBJETIVOS ESPECÍFICOS: ", fontManager.getBoldFont());
ObjetivoDisciplinaDTO[] objetivosDisciplina = teachingDocumentsService.findAllObjetivosDisciplinas(disciplina.getId());
// Paragraph objetivos = new Paragraph("asdfasdfasdfasdf", fontManager.getDefaultFont());
cellObjetivos = new PdfPCell();
cellObjetivos.addElement(objetivosHead);
List objetivosList = new List(List.ORDERED, List.ALPHABETICAL);
objetivosList.setLowercase(true);
for (ObjetivoDisciplinaDTO objetivoDisciplina : objetivosDisciplina) {
ListItem item = new ListItem(objetivoDisciplina.getDescricao() + " (" + objetivoDisciplina.getNivelAprendizagem().getCodigo() + ")", fontManager.getDefaultFont());
objetivosList.add(item);
}
cellObjetivos.addElement(objetivosList);
cellObjetivos.setColspan(6);
cellObjetivos.setPadding(10);
table.addCell(cellObjetivos);
return table;
}
Aggregations