List of usage examples for com.lowagie.text Chunk Chunk
public Chunk(DrawInterface separator)
From source file:at.reppeitsolutions.formbuilder.components.pdf.formbuilder.PdfFormBuilderHorizontalRule.java
License:Open Source License
@Override public Element render() { Chunk c = new Chunk(new LineSeparator()); Font f = new Font(); f.setSize(2);/*from ww w.j a v a 2 s .co m*/ c.setFont(f); return c; }
From source file:biblivre3.administration.reports.BaseBiblivreReport.java
License:Open Source License
@Override public void onEndPage(PdfWriter writer, Document document) { try {//from www . j ava 2 s . co m Rectangle page = document.getPageSize(); PdfPTable head = new PdfPTable(1); PdfPCell cell = new PdfPCell(new Paragraph(this.getText("REPORTS_HEADER"))); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); cell.setVerticalAlignment(PdfPCell.ALIGN_CENTER); cell.setBorder(Rectangle.BOTTOM); head.addCell(cell); head.setTotalWidth((page.width() / 2) - document.leftMargin()); head.writeSelectedRows(0, -1, document.leftMargin(), page.height() - document.topMargin() + head.getTotalHeight(), writer.getDirectContent()); PdfPTable date = new PdfPTable(1); PdfPCell dateCell = new PdfPCell(new Paragraph(dateFormat.format(generationDate))); dateCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); dateCell.setVerticalAlignment(PdfPCell.ALIGN_CENTER); dateCell.setBorder(Rectangle.BOTTOM); date.addCell(dateCell); date.setTotalWidth((page.width() / 2) - document.rightMargin()); date.writeSelectedRows(0, -1, (page.width() / 2), page.height() - document.topMargin() + head.getTotalHeight(), writer.getDirectContent()); PdfPTable foot = new PdfPTable(1); Chunk pageNumber = new Chunk(String.valueOf(document.getPageNumber())); pageNumber.setFont(footerFont); cell = new PdfPCell(new Paragraph(pageNumber)); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); cell.setVerticalAlignment(PdfPCell.ALIGN_CENTER); cell.setBorder(Rectangle.TOP); foot.addCell(cell); foot.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin()); foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(), writer.getDirectContent()); } catch (Exception e) { throw new ExceptionConverter(e); } }
From source file:biblivre3.administration.reports.BaseBiblivreReport.java
License:Open Source License
protected Chunk getNormalChunk(String text) { Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, "")); chunk.setFont(textFont); return chunk; }
From source file:biblivre3.administration.reports.BaseBiblivreReport.java
License:Open Source License
protected Chunk getBoldChunk(String text) { Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, "")); chunk.setFont(boldFont); return chunk; }
From source file:biblivre3.administration.reports.BaseBiblivreReport.java
License:Open Source License
protected Chunk getSmallFontChunk(String text) { Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, "")); chunk.setFont(smallFont);/*from ww w . ja v a 2 s. c o m*/ return chunk; }
From source file:biblivre3.administration.reports.BaseBiblivreReport.java
License:Open Source License
protected Chunk getHeaderChunk(String text) { Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, "")); chunk.setFont(headerFont);/*from w w w. ja va 2 s. c o m*/ return chunk; }
From source file:ca.nines.ise.writer.RTFWriter.java
License:Open Source License
private void footnote(Note note) throws IOException, DocumentException { Footnote fn = new Footnote("", fnStyle); fn.add(new Chunk(note.getNote("1").unicode().trim())); p.add(fn);/*from ww w .j a va2s.co m*/ }
From source file:ch.gpb.elexis.kgexporter.pdf.PdfHandler.java
License:Open Source License
public static void createPdf(Patient patient, String filename, LinkedList<String[]> laborBlatt) throws IOException, DocumentException { BaseFont bf_helv = BaseFont.createFont(BaseFont.HELVETICA, "Cp1252", true); fontTimes = new com.lowagie.text.Font(bf_helv, 6); // step 1/*from ww w.j ava 2s . co m*/ Document document = new Document(PageSize.A4.rotate()); // step 2 PdfWriter.getInstance(document, new FileOutputStream(filename)); // step 3 document.setHeader(getHeader( patient.getVorname() + " " + patient.getName() + " Geburtsdatum: " + patient.getGeburtsdatum())); document.open(); document.add(new Chunk("")); // << this will do the trick. // step 4 document.add(createTable2(laborBlatt)); // step 5 document.close(); }
From source file:ch.gpb.elexis.kgexporter.pdf.PdfHandler.java
License:Open Source License
public static void createDiagnosenSheet(Patient patient, String filename, String footerText) throws DocumentException, IOException { StringBuffer sb = new StringBuffer("Diagnosen:\n"); sb.append(patient.getDiagnosen());//from w w w .j a v a 2 s .c om sb.append("\n"); sb.append("Persnliche Anamnese:\n"); sb.append(patient.getPersAnamnese()); sb.append("\n"); // step 1 Document document = new Document(PageSize.A4); // step 2 PdfWriter.getInstance(document, new FileOutputStream(filename)); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename)); // step 3 //Rectangle rect = new Rectangle(30, 30, 559, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent event = new HeaderFooterPageEvent(); event.setHeaderText( patient.getVorname() + " " + patient.getName() + " (" + patient.getGeburtsdatum() + ")"); event.setFooterText(footerText); writer.setPageEvent(event); document.setMargins(36, 72, 60, 60); // step 3 document.open(); document.add(new Chunk("")); // << this will do the trick. if (patient.getDiagnosen().length() > 0) { Paragraph p = new Paragraph("Diagnosen:", fontTimesTitle); p.setSpacingAfter(10f); document.add(p); String[] chunksDiag = patient.getDiagnosen().toString().split("(?m)^\\s*$"); for (String chunk : chunksDiag) { document.add(new Paragraph(chunk, fontTimes)); } } else { document.add(new Paragraph("Keine Diagnosen vorhanden", fontTimes)); } if (patient.getPersAnamnese().length() > 0) { Paragraph p = new Paragraph("Persnliche Anamnese:", fontTimesTitle); p.setSpacingBefore(10f); p.setSpacingAfter(10f); document.add(p); String[] chunksAnam = patient.getPersAnamnese().toString().split("(?m)^\\s*$"); for (String chunk : chunksAnam) { document.add(new Paragraph(chunk, fontTimes)); } } else { document.add(new Paragraph("Keine Persnliche Anamnese vorhanden", fontTimes)); } // step 5 document.close(); }
From source file:ch.gpb.elexis.kgexporter.pdf.PdfHandler.java
License:Open Source License
public static void createFixMediSheet(Patient patient, String filename, String footerText) throws DocumentException, IOException { Prescription[] prescriptions = patient.getFixmedikation(); StringBuffer sb = new StringBuffer(); for (Prescription prescription : prescriptions) { //System.out.println("Prescription: " + prescription.getLabel() + "/" + prescription.getDosis()); sb.append(prescription.getLabel()); sb.append("\r\n"); }/*from ww w .ja v a2 s. co m*/ // step 1 Document document = new Document(PageSize.A4); // step 2 PdfWriter.getInstance(document, new FileOutputStream(filename)); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename)); // step 3 //Rectangle rect = new Rectangle(30, 30, 559, 800); writer.setBoxSize("art", rect); HeaderFooterPageEvent event = new HeaderFooterPageEvent(); event.setHeaderText( patient.getVorname() + " " + patient.getName() + " (" + patient.getGeburtsdatum() + ")"); event.setFooterText(footerText); writer.setPageEvent(event); document.setMargins(36, 72, 60, 60); // step 3 document.open(); document.add(new Chunk("")); // << this will do the trick. if (sb.length() > 0) { Paragraph p = new Paragraph("Fixmedikation:", fontTimesTitle); p.setSpacingAfter(10f); document.add(p); String[] chunksDiag = sb.toString().split("(?m)^\\s*$"); for (String chunk : chunksDiag) { document.add(new Paragraph(chunk, fontTimes)); } } else { //document.add(new Paragraph("Keine Medikationen vorhanden", fontTimes)); Paragraph p = new Paragraph(new Chunk("Keine Medikationen vorhanden", fontTimesTitle)); p.setSpacingBefore(20f); document.add(p); } // step 5 document.close(); }