use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC005PDF method makeReport.
@Override
public void makeReport() {
teachingDocumentsService = (TeachingDocumentsService) services.get("teachingDocumentsService");
document = documentManager.getDocumentPortrait();
os = documentManager.prepareDocument(document);
writer = documentManager.getWritter();
ChapterSectionTOC eventHandler = new ChapterSectionTOC();
writer.setPageEvent(eventHandler);
document.open();
CSSResolver cssResolver = new StyleAttrCSSResolver();
CssFile cssFile = null;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String cssStylePath = classLoader.getResource("doc3-styles.css").getPath();
cssFile = XMLWorkerHelper.getCSS(classLoader.getResourceAsStream("doc3-styles.css"));
cssResolver.addCss(cssFile);
XMLWorkerFontProvider fontProvider = new XMLWorkerFontProvider(XMLWorkerFontProvider.DONTLOOKFORFONTS);
String fontFilePath = classLoader.getResource("MyriadPro-Regular.otf").getPath();
// fontProvider.register(fontFilePath);
CssAppliers cssAppliers = new CssAppliersImpl(fontProvider);
HtmlPipelineContext htmlContext = new HtmlPipelineContext(cssAppliers);
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
PdfWriterPipeline pdf = new PdfWriterPipeline(document, writer);
HtmlPipeline html = new HtmlPipeline(htmlContext, pdf);
CssResolverPipeline css = new CssResolverPipeline(cssResolver, html);
XMLWorker worker = new XMLWorker(css, true);
p = new XMLParser(worker);
try {
String secaoIdParam = (String) params.get("secaoId");
document.add(Chunk.NEXTPAGE);
SecaoApostilaDTO secao = teachingDocumentsService.findSecaoApostila(Long.parseLong(secaoIdParam));
Chapter ch = new Chapter(0);
ch.setNumberDepth(0);
if (secao.getContent() != null) {
buildSection(ch, secao, p, document);
}
document.add(ch);
} catch (DocumentException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
throw new CoreException(e.getMessage());
} catch (IOException ex) {
Logger.getLogger(DOC005PDF.class.getName()).log(Level.SEVERE, null, ex);
} finally {
document.close();
}
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC002PDF method buildComplementacaoInstrucao.
private Chapter buildComplementacaoInstrucao(CurriculoMinimoDTO curriculo) throws DocumentException {
Chapter ch = new Chapter(new Paragraph("COMPLEMENTAÇÃO DA INSTRUÇÃO", fontManager.getBoldFont()), 3);
ch.add(Chunk.NEWLINE);
PdfPTable tableComplementacaoInstrucao = buildComplamentacaoInstrucaoTable(curriculo);
ch.add(tableComplementacaoInstrucao);
ch.add(Chunk.NEWLINE);
PdfPTable tableFlexibilidade = buildFlexibilidadeTable(curriculo);
ch.add(tableFlexibilidade);
return ch;
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC002PDF method buildDisposicoesFinais.
private Chapter buildDisposicoesFinais(CurriculoMinimoDTO curriculo) {
Chapter ch = new Chapter(new Paragraph("DISPOSIÇÕES FINAIS", fontManager.getBoldFont()), 8);
ch.add(Chunk.NEWLINE);
IReportUtil.fillChapter(ch, curriculo.getDisposicoesFinais2());
return ch;
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC002PDF 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;
}
use of com.itextpdf.text.Chapter in project trainning by fernandotomasio.
the class DOC002PDF method buildAbreviaturas.
private Chapter buildAbreviaturas(CurriculoMinimoDTO curriculo) {
Paragraph p = new Paragraph("LISTA DE ABREVIATURAS", fontManager.getBoldFont());
p.setAlignment(Element.ALIGN_CENTER);
Chapter ch = new Chapter(p, 0);
ch.setNumberDepth(0);
ch.add(Chunk.NEWLINE);
AbreviaturaDTO[] abreviaturas = teachingDocumentsService.findAllAbreviaturasByPUD(curriculo.getId());
for (AbreviaturaDTO abreviatura : abreviaturas) {
String item = abreviatura.getSigla() + " - " + abreviatura.getDescricao();
Paragraph itemParagraph = new Paragraph(item, fontManager.getDefaultFont());
itemParagraph.setAlignment(Element.ALIGN_LEFT);
ch.add(itemParagraph);
}
return ch;
}
Aggregations