use of com.itextpdf.text.Paragraph in project trainning by fernandotomasio.
the class DOC002PDF method buildFrontispicio.
private void buildFrontispicio(Document document, CurriculoMinimoDTO curriculoMinimo) throws DocumentException {
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
Paragraph p1 = new Paragraph();
p1.setAlignment(Element.ALIGN_CENTER);
p1.add(new Phrase("MINISTÉRIO DA DEFESA", fontManager.getH1Font()));
document.add(p1);
Paragraph p2 = new Paragraph();
p2.setAlignment(Element.ALIGN_CENTER);
p2.add(new Phrase("COMANDO DA AERONÁUTICA", fontManager.getH1Font()));
document.add(p2);
Paragraph p3 = new Paragraph();
p3.setAlignment(Element.ALIGN_CENTER);
p3.add(new Phrase("DEPARTAMENTO DE CONTROLE DO ESPAÇO AÉREO", fontManager.getDefaultFont()));
document.add(p3);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String path = classLoader.getResource("aer.png").getPath();
Image image = Image.getInstance(path);
image.setAlignment(Element.ALIGN_CENTER);
image.scalePercent(18);
document.add(image);
} catch (BadElementException | IOException ex) {
Logger.getLogger(DOC001PDF.class.getName()).log(Level.SEVERE, null, ex);
}
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
Paragraph p4 = new Paragraph();
p4.setAlignment(Element.ALIGN_CENTER);
p4.add(new Phrase("ENSINO", fontManager.getH1Font()));
document.add(p4);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
PdfPTable t = new PdfPTable(1);
PdfPCell unica = new PdfPCell();
unica.setPadding(10);
// Paragraph p5 = new Paragraph();
// p5.setAlignment(Element.ALIGN_CENTER);
// p5.add(new Phrase("ICA 56-3", fontManager.getDefaultFont()));
// p5.add(Chunk.NEWLINE);
Paragraph p6 = new Paragraph();
p6.setAlignment(Element.ALIGN_CENTER);
// p6.add(new Phrase(curriculoMinimo.getCurso().getDescricao(), fontManager.getDefaultFont()));
// Paragraph p7 = new Paragraph();
// p7.setAlignment(Element.ALIGN_CENTER);
// p7.add(new Phrase("PLANO DE UNIDADES DIDÁTICAS DO CURSO " + curriculoMinimo.getCurso().getCodigo(), fontManager.getDefaultFont()));
// Paragraph p8 = new Paragraph();
// p8.setAlignment(Element.ALIGN_CENTER);
// p8.add(new Phrase(curriculoMinimo.getAnoPublicacaoPUD(), fontManager.getDefaultFont()));
p6.add(new Phrase("PLANO DE UNIDADES DIDÁTICAS DO CURSO " + curriculoMinimo.getCurso().getDescricao(), fontManager.getDefaultFont()));
Paragraph p7 = new Paragraph();
p7.setAlignment(Element.ALIGN_CENTER);
p7.add(new Phrase(curriculoMinimo.getCurso().getCodigo(), fontManager.getDefaultFont()));
Paragraph p8 = new Paragraph();
p8.setAlignment(Element.ALIGN_CENTER);
p8.add(new Phrase(curriculoMinimo.getAnoPublicacaoPUD(), fontManager.getDefaultFont()));
// unica.addElement(p5);
unica.addElement(Chunk.NEWLINE);
unica.addElement(p6);
unica.addElement(p7);
unica.addElement(Chunk.NEWLINE);
unica.addElement(p8);
unica.addElement(Chunk.NEWLINE);
t.addCell(unica);
document.add(t);
// document.add(Chunk.NEXTPAGE);
//
// document.add(buildPrefacio(curriculoMinimo));
document.add(Chunk.NEXTPAGE);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
}
use of com.itextpdf.text.Paragraph in project trainning by fernandotomasio.
the class DOC002PDF method buildTableReferencias.
private PdfPTable buildTableReferencias(DisciplinaDTO disciplina) {
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100);
PdfPCell cellHeader;
cellHeader = new PdfPCell(new Phrase("REFERÊNCIAS", fontManager.getBoldFont()));
cellHeader.setPadding(10);
table.addCell(cellHeader);
PdfPCell cellContent;
cellContent = new PdfPCell();
ReferenciaDTO[] referencias = teachingDocumentsService.findAllReferenciasByDisciplina(disciplina.getId());
for (ReferenciaDTO referencia : referencias) {
Paragraph referenciaParagraph = new Paragraph(referencia.getTexto(), fontManager.getDefaultFont());
cellContent.addElement(referenciaParagraph);
}
cellContent.setPadding(10);
table.addCell(cellContent);
return table;
}
use of com.itextpdf.text.Paragraph in project trainning by fernandotomasio.
the class EXC001IReport method makeReport.
@Override
public void makeReport() {
AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
document = documentManager.getDocumentPortrait();
os = documentManager.prepareDocument(document);
writer = documentManager.getWritter();
document.open();
Long turmaId = (Long) params.get("turmaId");
TurmaDTO turma = service.findTurmaEfetiva(turmaId);
IndicacaoDTO[] indicacoes = service.findAllIndicacoesAlunos(turmaId);
try {
Paragraph p = null;
p = new Paragraph(ReportUtil.convertEncode(turma.getCurso().getCodigo()) + " - " + ReportUtil.convertEncode(turma.getCurso().getDescricao()), fontManager.getH1Font());
p.setAlignment(Element.ALIGN_LEFT);
document.add(p);
PdfPTable tableIndicacoes = new PdfPTable(4);
tableIndicacoes.addCell(tableManager.getHeaderCell("Nome"));
tableIndicacoes.addCell(tableManager.getHeaderCell("Nome de Guerra"));
tableIndicacoes.addCell(tableManager.getHeaderCell("SARAM"));
tableIndicacoes.addCell(tableManager.getHeaderCell("CPF"));
tableIndicacoes.addCell(tableManager.getHeaderCell("Organização"));
for (IndicacaoDTO indicacao : indicacoes) {
PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
String nomeGuerra = pessoa.getNomeGuerra();
if (nomeGuerra == null) {
nomeGuerra = "";
}
tableIndicacoes.addCell(tableManager.getPhraseCellLeft(pessoa.getTargetaCompleta()));
tableIndicacoes.addCell(tableManager.getPhraseCellCenter(nomeGuerra));
tableIndicacoes.addCell(tableManager.getPhraseCellCenter(pessoa.getSaram()));
tableIndicacoes.addCell(tableManager.getPhraseCellCenter(pessoa.getCpf()));
OrganizacaoDTO organizacao = organizationalService.findOrganizacao(indicacao.getOrganizacao().getId());
tableIndicacoes.addCell(tableManager.getPhraseCellCenter(organizacao.getSigla()));
}
document.add(tableIndicacoes);
} catch (DocumentException ex) {
Logger.getLogger(EXC001IReport.class.getName()).log(Level.SEVERE, null, ex);
} finally {
document.close();
}
}
use of com.itextpdf.text.Paragraph in project trainning by fernandotomasio.
the class IReportUtil method fillChapter.
public static Chapter fillChapter(Chapter ch, String text) {
if (text != null && text.length() > 0) {
String[] split = text.split("\n");
int countParagraphs = 0;
for (String item : split) {
if (item.length() > 1) {
char c = item.charAt(1);
if (c != '-' && c != ')' && c != '.') {
countParagraphs++;
}
}
}
if (countParagraphs > 1) {
for (String item : split) {
if (item.length() > 1) {
char c = item.charAt(1);
if (c == '-' || c == ')' || c == '.') {
Paragraph p = new Paragraph(item, fontManager.getDefaultFont());
p.setIndentationLeft(50);
p.setAlignment(Element.ALIGN_JUSTIFIED);
ch.add(p);
} else {
Paragraph p = new Paragraph(item, fontManager.getDefaultFont());
p.setAlignment(Element.ALIGN_JUSTIFIED);
ch.addSection(p);
}
}
}
} else {
for (String item : split) {
if (item.length() > 1) {
char c = item.charAt(1);
if (c == '-' || c == ')' || c == '.') {
Paragraph p = new Paragraph(item, fontManager.getDefaultFont());
p.setIndentationLeft(50);
p.setAlignment(Element.ALIGN_JUSTIFIED);
ch.add(p);
} else {
Paragraph p = new Paragraph(item, fontManager.getDefaultFont());
p.setFirstLineIndent(50);
p.setAlignment(Element.ALIGN_JUSTIFIED);
ch.add(p);
}
}
}
}
}
return ch;
}
use of com.itextpdf.text.Paragraph in project trainning by fernandotomasio.
the class IReportUtil method fillChapterWithoutNumbers.
public static Chapter fillChapterWithoutNumbers(Chapter ch, String text) {
if (text != null && text.length() > 0) {
String[] split = text.split("\n");
int countParagraphs = 0;
for (String item : split) {
if (item.length() > 1) {
char c = item.charAt(1);
if (c != '-' && c != ')' && c != '.') {
countParagraphs++;
}
}
}
for (String item : split) {
if (item.length() > 1) {
char c = item.charAt(1);
if (c == '-' || c == ')' || c == '.') {
Paragraph p = new Paragraph(item, fontManager.getDefaultFont());
p.setIndentationLeft(50);
p.setAlignment(Element.ALIGN_JUSTIFIED);
ch.add(p);
} else {
Paragraph p = new Paragraph(item, fontManager.getDefaultFont());
p.setFirstLineIndent(50);
p.setAlignment(Element.ALIGN_JUSTIFIED);
ch.add(p);
}
}
}
}
return ch;
}
Aggregations