use of com.itextpdf.text.Chapter in project opentheso by miledrousset.
the class itextPdf method start_test.
@Test
public void start_test() throws DocumentException, FileNotFoundException {
try {
// step 1
Document document = new Document();
// step 2
PdfWriter.getInstance(document, new FileOutputStream("test-itext.pdf"));
// step 3
document.open();
String FONT = "fonts/FreeSans.ttf";
BaseFont bf1 = BaseFont.createFont(FONT, BaseFont.WINANSI, BaseFont.EMBEDDED);
Font french = new Font(bf1, 12);
BaseFont bf2 = BaseFont.createFont(FONT, BaseFont.CP1250, BaseFont.EMBEDDED);
Font czech = new Font(bf2, 12);
BaseFont bf3 = BaseFont.createFont(FONT, "Cp1251", BaseFont.EMBEDDED);
Font russian = new Font(bf3, 12);
document.add(new Paragraph("Vous \u00eates d'o\u00f9?", french));
document.add(new Paragraph("\u00c0 tout \u00e0 l'heure. \u00c0 bient\u00f4t.", french));
document.add(new Paragraph("Je me pr\u00e9sente.", french));
document.add(new Paragraph("C'est un \u00e9tudiant.", french));
document.add(new Paragraph("\u00c7a va?", french));
document.add(new Paragraph("Il est ing\u00e9nieur. Elle est m\u00e9decin.", french));
document.add(new Paragraph("C'est une fen\u00eatre.", french));
document.add(new Paragraph("R\u00e9p\u00e9tez, s'il vous pla\u00eet.", french));
document.add(new Paragraph("Odkud jste?", czech));
document.add(new Paragraph("Uvid\u00edme se za chvilku. M\u011bj se.", czech));
document.add(new Paragraph("Dovolte, abych se p\u0159edstavil.", czech));
document.add(new Paragraph("To je studentka.", czech));
document.add(new Paragraph("V\u0161echno v po\u0159\u00e1dku?", czech));
document.add(new Paragraph("On je in\u017een\u00fdr. Ona je l\u00e9ka\u0159.", czech));
document.add(new Paragraph("Toto je okno.", czech));
document.add(new Paragraph("Zopakujte to pros\u00edm.", czech));
document.add(new Paragraph("\u041e\u0442\u043a\u0443\u0434\u0430 \u0442\u044b?", russian));
document.add(new Paragraph("\u0423\u0432\u0438\u0434\u0438\u043c\u0441\u044f \u0432 \u043d\u0435\u043c\u043d\u043e\u0433\u043e. \u0423\u0432\u0438\u0434\u0438\u043c\u0441\u044f.", russian));
document.add(new Paragraph("\u041f\u043e\u0437\u0432\u043e\u043b\u044c\u0442\u0435 \u043c\u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c\u0441\u044f.", russian));
document.add(new Paragraph("\u042d\u0442\u043e \u0441\u0442\u0443\u0434\u0435\u043d\u0442.", russian));
document.add(new Paragraph("\u0425\u043e\u0440\u043e\u0448\u043e?", russian));
document.add(new Paragraph("\u041e\u043d \u0438\u043d\u0436\u0435\u043d\u0435\u0440. \u041e\u043d\u0430 \u0434\u043e\u043a\u0442\u043e\u0440.", russian));
document.add(new Paragraph("\u042d\u0442\u043e \u043e\u043a\u043d\u043e.", russian));
document.add(new Paragraph("\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.", russian));
Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 30, Font.BOLD);
document.add(new Paragraph("Title of the document", catFont));
// step 4
document.add(new Paragraph("Hello World!\n test \n test"));
Chunk chunk = new Chunk("Go to Contact information");
chunk.setLocalGoto("contact");
document.add(new Paragraph(chunk));
document.newPage();
document.add(new Paragraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut consectetur, nisi non commodo interdum, nunc massa sodales velit, vel elementum ipsum odio id ligula. Aliquam sed sapien eget nibh varius varius id ac quam. Aliquam id arcu enim. Curabitur sollicitudin placerat dui, nec venenatis ipsum consectetur ut. Fusce sem nibh, semper et nibh sed, varius mattis ipsum. Duis tristique mauris velit. Nam eleifend sapien tempus, sollicitudin risus sit amet, dignissim nisl. Aliquam tincidunt rutrum auctor. Integer sollicitudin lectus faucibus ipsum facilisis imperdiet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam erat volutpat. Etiam eu commodo massa, ac venenatis est. Sed venenatis mattis vehicula. Duis eleifend lacus nec purus convallis, non mollis justo commodo. Aenean et arcu vitae metus pharetra venenatis ac non tellus. Vestibulum ultrices turpis urna, vitae condimentum sem pharetra in.\n" + "\n" + "Maecenas aliquet auctor ipsum eget congue. Sed at ullamcorper ante. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse scelerisque at erat at condimentum. Vivamus sed aliquet risus, non tempor odio. Etiam pulvinar, mauris ut placerat consequat, ipsum massa imperdiet turpis, eget consequat justo metus sit amet ligula. Donec vel lacinia erat. Donec eget enim sed justo euismod vehicula ut in metus. Suspendisse augue dolor, tempor eu mollis vitae, pellentesque sit amet nulla. Morbi ac sapien arcu. Vivamus in elit dictum orci dapibus blandit eget vitae est. Morbi sed ultricies neque. Ut at fringilla urna. Quisque dictum bibendum nisi, non pellentesque velit cursus vel.\n" + "\n" + "Etiam convallis tincidunt arcu sit amet pellentesque. Suspendisse vitae gravida tellus. Fusce consectetur turpis condimentum, molestie libero pellentesque, aliquet dolor. Duis ullamcorper purus sem, id ornare lacus interdum non. Aenean quis arcu elementum, ultrices tellus sed, dapibus nisl. Aliquam ut iaculis mi, vitae porttitor tellus. Vestibulum lacinia velit sed venenatis volutpat. Nullam magna ipsum, feugiat vestibulum nunc tincidunt, egestas ultrices libero. Quisque fringilla risus ut lectus posuere vulputate. Fusce diam mi, efficitur vitae nulla eget, facilisis luctus nisi. Sed scelerisque hendrerit porttitor. Aenean mollis, urna in bibendum bibendum, lectus orci dictum sapien, ut pretium dui lacus vel turpis. Nunc hendrerit est sit amet turpis venenatis suscipit. Phasellus fermentum aliquam tellus nec sodales.\n" + "\n" + "Etiam eget scelerisque erat, nec commodo arcu. Nullam tempus vehicula auctor. Integer feugiat ornare viverra. In nulla arcu, faucibus ut risus malesuada, elementum egestas eros. Maecenas varius augue faucibus, vulputate turpis at, vestibulum nisi. Etiam placerat vehicula erat, ac viverra nulla interdum id. Sed nibh sem, bibendum ac sodales vitae, iaculis vel magna. Phasellus fringilla quis lectus ac egestas. Praesent iaculis, orci non ultrices mattis, urna ipsum suscipit tortor, nec viverra mi tortor id libero. Quisque vehicula malesuada elit, vitae interdum nunc. In laoreet viverra scelerisque. Nam venenatis blandit tortor, vel aliquam mi rutrum eget. In ut nibh ut nibh lobortis ullamcorper. Morbi neque elit, dictum vel justo nec, pulvinar fermentum purus. Sed consequat dictum hendrerit. Quisque pulvinar mi volutpat est aliquet facilisis.\n" + "\n" + "Phasellus ultrices euismod ligula, ac sagittis diam semper eu. Nulla aliquam justo vel leo congue condimentum. Fusce molestie tellus felis, vel fringilla mi molestie ac. Praesent venenatis sapien eget lectus gravida, vitae condimentum ligula sagittis. Mauris varius placerat sagittis. Phasellus eget tortor quis felis pellentesque malesuada pharetra a lectus. Sed rutrum mi id aliquam lacinia. Donec posuere auctor vulputate. Duis a ante id nisl cursus accumsan. "));
Chunk chunk1 = new Chunk("Contact information");
chunk1.setLocalDestination("contact");
Chapter chapter = new Chapter(new Paragraph(chunk1), 1);
chapter.setNumberDepth(0);
document.add(chapter);
PdfPTable table = new PdfPTable(2);
table.addCell(new Paragraph("test 1", catFont));
table.addCell("2");
document.add(table);
// step 5
document.close();
} catch (IOException ex) {
Logger.getLogger(itextPdf.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC001PDF method buildReferencias.
private Chapter buildReferencias(CurriculoMinimoDTO curriculo) {
Paragraph p = new Paragraph("REFERÊNCIAS", fontManager.getBoldFont());
p.setAlignment(Element.ALIGN_CENTER);
Chapter ch = new Chapter(p, 0);
ch.setNumberDepth(0);
ch.add(Chunk.NEWLINE);
Paragraph p1 = new Paragraph("BRASIL. Comando da Aeronáutica. Comando-Geral do Pessoal. Norma de Sistema do Comando da Aeronáutica (NSCA) 5-1, de 23 de novembro de 2011. Norma disciplinando a confecção, controle e numeração de publicações do Comando da Aeronáutica. Boletim do Comando da Aeronáutica nº 225 de 29 de novembro de 2011.", fontManager.getDefaultFont());
p1.setAlignment(Element.ALIGN_JUSTIFIED);
ch.add(p1);
ch.add(Chunk.NEWLINE);
Paragraph p2 = new Paragraph("______. Comando da Aeronáutica. Departamento de Ensino da Aeronáutica. Instrução do Comando da Aeronáutica (ICA) 37-4, de 18 de março de 2010. Instrução referente à elaboração e revisão de currículos mínimos. Boletim do Comando da Aeronáutica nº 55, de 23 de outubro de 2010.", fontManager.getDefaultFont());
p2.setAlignment(Element.ALIGN_JUSTIFIED);
ch.add(p2);
return ch;
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC001PDF method buildChapter3.
private Chapter buildChapter3(CurriculoMinimoDTO curriculo) {
Chapter ch = new Chapter(new Paragraph("PADRÃO DE DESEMPENHO E PERFIL DO ALUNO", fontManager.getBoldFont()), 3);
if (curriculo.getPadraoDesempenhoEspecializado() != null && curriculo.getPadraoDesempenhoEspecializado().length() > 0) {
Section section1 = ch.addSection(new Paragraph("PADRÃO DE DESEMPENHO DO CAMPO TÉCNICO-ESPECIALIZADO", fontManager.getUnderlineFont()));
IReportUtil.fillSection(section1, curriculo.getPadraoDesempenhoEspecializado());
}
if (curriculo.getPadraoDesempenhoMilitar() != null && curriculo.getPadraoDesempenhoMilitar().length() > 0) {
Section section2 = ch.addSection(new Paragraph("PADRÃO DE DESEMPENHO DO CAMPO MILITAR", fontManager.getUnderlineFont()));
Paragraph p2 = new Paragraph(curriculo.getPadraoDesempenhoMilitar(), fontManager.getDefaultFont());
section2.add(p2);
}
if (curriculo.getPadraoDesempenhoGeral() != null && curriculo.getPadraoDesempenhoGeral().length() > 0) {
Section section3 = ch.addSection(new Paragraph("PADRÃO DE DESEMPENHO DO CAMPO GERAL", fontManager.getUnderlineFont()));
Paragraph p3 = new Paragraph(curriculo.getPadraoDesempenhoGeral(), fontManager.getDefaultFont());
section3.add(p3);
}
Section section4 = ch.addSection(new Paragraph("PERFIL DO ALUNO", fontManager.getUnderlineFont()));
IReportUtil.fillSection(section4, curriculo.getPerfilAluno());
return ch;
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC001PDF method buildChapter8.
private Chapter buildChapter8(CurriculoMinimoDTO curriculo) {
Chapter ch = new Chapter(new Paragraph("DISPOSIÇÕES FINAIS", fontManager.getBoldFont()), 8);
ch.add(Chunk.NEWLINE);
IReportUtil.fillChapter(ch, curriculo.getDisposicoesFinais());
return ch;
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC001PDF method buildSumario.
private Chapter buildSumario(ArrayList<Paragraph> titles) throws DocumentException {
Paragraph p = new Paragraph("SUMÁRIO", fontManager.getBoldFont());
p.setAlignment(Element.ALIGN_CENTER);
Chapter ch = new Chapter(p, 0);
ch.setNumberDepth(0);
ch.add(Chunk.NEWLINE);
for (Paragraph title : titles) {
ch.add(title);
}
return ch;
}
Aggregations