List of usage examples for com.lowagie.text Paragraph add
public boolean add(Object o)
Object
to the Paragraph
. From source file:gov.utah.health.uper.reports.Registration.java
private void buildParent(Document document, PatientBean pt) throws DocumentException { Paragraph preface = new Paragraph(PARENT, normalFontBold); preface.setAlignment(Element.ALIGN_LEFT); document.add(preface);//w ww . j a va2 s .c o m preface = new Paragraph("Name: ", normalFontBold); preface.add(pt.getParentFirstName() + " " + pt.getParentLastName()); preface.setAlignment(Element.ALIGN_LEFT); document.add(preface); preface = new Paragraph("Date of Birth: ", normalFontBold); preface.add(pt.getParentDob()); preface.setAlignment(Element.ALIGN_LEFT); document.add(preface); preface = new Paragraph("Address: ", normalFontBold); StringBuilder sb = new StringBuilder(pt.getParentAddressCurrent()); sb.append(" "); sb.append(pt.getParentCityCurrent()); sb.append(", "); sb.append(pt.getParentStateCurrent()); sb.append(" "); sb.append(pt.getParentZipCurrent()); preface.add(sb.toString()); preface.setAlignment(Element.ALIGN_LEFT); document.add(preface); addSpacing(document); }
From source file:gov.utah.health.uper.reports.Registration.java
private void buildPhysician(Document document, PatientBean pt) throws DocumentException { Paragraph preface = new Paragraph(PHYSICIAN, normalFontBold); preface.setAlignment(Element.ALIGN_LEFT); document.add(preface);//from ww w . ja v a 2 s . co m preface = new Paragraph("Name and Title: ", normalFontBold); preface.setAlignment(Element.ALIGN_LEFT); preface.add(pt.getPhysicianName()); document.add(preface); preface = new Paragraph("Utah License Number: ", normalFontBold); preface.add(pt.getDoplNumber()); preface.setAlignment(Element.ALIGN_LEFT); document.add(preface); preface = new Paragraph("Expiration Date: ", normalFontBold); preface.setAlignment(Element.ALIGN_LEFT); preface.add(pt.getLicenseExpireDate()); document.add(preface); addSpacing(document); }
From source file:io.vertigo.dynamo.plugins.export.rtf.RTFExporter.java
License:Apache License
/** {@inheritDoc} */ @Override/*from w w w. j a va2 s .c o m*/ protected void createWriter(final Document document, final OutputStream out) { // final RtfWriter2 writer = RtfWriter2.getInstance(document, out); // writer.setViewerPreferences(PdfWriter.PageLayoutTwoColumnLeft); // advanced page numbers : x/y final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL); //----- final Paragraph footerParagraph = new Paragraph(); footerParagraph.add(new RtfPageNumber(font)); footerParagraph.add(new Phrase(" / ", font)); footerParagraph.add(new RtfTotalPageNumber(font)); footerParagraph.setAlignment(Element.ALIGN_CENTER); //----- final HeaderFooter footer = new RtfHeaderFooter(footerParagraph); footer.setBorder(Rectangle.TOP); document.setFooter(footer); }
From source file:io.vertigo.quarto.plugins.export.rtf.RTFExporter.java
License:Apache License
/** {@inheritDoc} */ @Override// w w w. j a v a2 s.c o m protected void createWriter(final Document document, final OutputStream out) { RtfWriter2.getInstance(document, out); // advanced page numbers : x/y final Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL); //----- final Paragraph footerParagraph = new Paragraph(); footerParagraph.add(new RtfPageNumber(font)); footerParagraph.add(new Phrase(" / ", font)); footerParagraph.add(new RtfTotalPageNumber(font)); footerParagraph.setAlignment(Element.ALIGN_CENTER); //----- final HeaderFooter footer = new RtfHeaderFooter(footerParagraph); footer.setBorder(Rectangle.TOP); document.setFooter(footer); }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * returns the cell for the result of a workflow: status of this workflow * //w w w .j av a2 s . c om * @param workflow * @param mRequest * @return * @throws BadElementException * @throws MalformedURLException * @throws IOException */ private Cell getWorkflowResult(Workflow3VO workflow, HttpServletRequest mRequest) throws BadElementException, MalformedURLException, IOException { Cell resultsCell = new Cell(); Paragraph p = new Paragraph(); if (workflow != null && workflow.getWorkflowType() != null) { p.add(new Phrase(workflow.getWorkflowType() + " ", FONT_DOC_BOLD)); String img = mRequest.getRealPath(Constants.IMAGE_BLANK); String wfStatus = workflow.getStatus(); if (wfStatus != null) { if (wfStatus.equals("Failure")) { img = mRequest.getRealPath(Constants.IMAGE_FAILED); } else if (wfStatus.equals("Launched")) { img = mRequest.getRealPath(Constants.IMAGE_LAUNCHED); } else if (wfStatus.equals("Success")) { img = mRequest.getRealPath(Constants.IMAGE_SUCCESS); } } p.add(getChunkImage(img)); p.add(new Phrase(" ")); } resultsCell.add(p); return resultsCell; }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * get Status for Characterization (indexing and Strategy) * //w w w . j a v a 2 s . c o m * @param dcInfo * @param mRequest * @return * @throws BadElementException * @throws MalformedURLException * @throws IOException */ private Cell getCharacterizationResultStatus(DataCollectionInformation dcInfo, HttpServletRequest mRequest) throws BadElementException, MalformedURLException, IOException { Cell resultsCell = new Cell(); Paragraph p = new Paragraph(); if (dcInfo != null && dcInfo.getScreeningIndexingSuccess() != null) { p.add(new Phrase("Indexing ", FONT_DOC_BOLD)); String img = mRequest.getRealPath(Constants.IMAGE_FAILED); if (dcInfo.getScreeningIndexingSuccess() == 1) { img = mRequest.getRealPath(Constants.IMAGE_SUCCESS); } p.add(getChunkImage(img)); p.add(new Phrase(" ")); } if (dcInfo != null && dcInfo.getScreeningStrategySuccess() != null) { p.add(new Phrase("Strategy ", FONT_DOC_BOLD)); String img = mRequest.getRealPath(Constants.IMAGE_FAILED); if (dcInfo.getScreeningStrategySuccess() == 1) { img = mRequest.getRealPath(Constants.IMAGE_SUCCESS); } p.add(getChunkImage(img)); p.add(new Phrase(" ")); } resultsCell.add(p); return resultsCell; }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * return the cell with the status of the different autoProc * //from ww w . j av a 2 s . c o m * @param dcInfo * @return * @throws IOException * @throws MalformedURLException * @throws BadElementException */ private Cell getAutoProcResultStatus(DataCollectionInformation dcInfo) throws BadElementException, MalformedURLException, IOException { Cell resultsCell = new Cell(); Paragraph p = new Paragraph(); // edna if (dcInfo != null && dcInfo.getAutoProcEdnaStatus() != null) { p.add(new Phrase("EDNA_proc ", FONT_DOC_BOLD)); p.add(getChunkImage(dcInfo.getAutoProcEdnaStatus())); p.add(new Phrase(" ")); } // fastproc if (dcInfo != null && dcInfo.getAutoProcFastStatus() != null) { p.add(new Phrase("grenades_fastproc ", FONT_DOC_BOLD)); p.add(getChunkImage(dcInfo.getAutoProcFastStatus())); p.add(new Phrase(" ")); } // parallelproc if (dcInfo != null && dcInfo.getAutoProcParallelStatus() != null) { p.add(new Phrase("grenades_parallelproc ", FONT_DOC_BOLD)); p.add(getChunkImage(dcInfo.getAutoProcParallelStatus())); p.add(new Phrase(" ")); } resultsCell.add(p); return resultsCell; }
From source file:ispyb.client.mx.results.ExportAutoProcAction.java
License:Open Source License
private void setAutoProcInfo(Document document) throws Exception { // header// ww w . j av a 2s. c o m Table headerTable = new Table(1); headerTable.getDefaultCell().setBorderWidth(0); headerTable.setBorderWidth(0); headerTable.setCellsFitPage(true); headerTable.setAlignment(Element.ALIGN_LEFT); headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); headerTable.getDefaultCell().setBackgroundColor(PdfRtfExporter.LIGHT_YELLOW_COLOR); headerTable.getDefaultCell().setLeading(3); headerTable.setWidth(100); // percentage headerTable .addCell(new Paragraph("Crystal data and data-collection statistics", PdfRtfExporter.FONT_DOC_11)); headerTable.addCell(new Paragraph("Values in parentheses are for the highest resolution shell.", PdfRtfExporter.FONT_DOC_11)); document.add(headerTable); document.add(new Paragraph(" ", PdfRtfExporter.VERY_SMALL_FONT)); // auto proc table Table autoProcTable = new Table(2); autoProcTable.getDefaultCell().setBorderWidth(0); autoProcTable.setBorderWidth(0); autoProcTable.setCellsFitPage(true); autoProcTable.setAlignment(Element.ALIGN_LEFT); autoProcTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // autoProcTable.getDefaultCell().setLeading(3); autoProcTable.setPadding(2); autoProcTable.setWidth(100); // percentage // data String spaceGroup = autoProc == null ? "" : autoProc.getSpaceGroup(); String unitCell_a = autoProc == null ? "" : autoProc.getRefinedCellA().toString(); String unitCell_b = autoProc == null ? "" : autoProc.getRefinedCellB().toString(); String unitCell_c = autoProc == null ? "" : autoProc.getRefinedCellC().toString(); String unitCell_alpha = autoProc == null ? "" : autoProc.getRefinedCellAlpha().toString(); String unitCell_beta = autoProc == null ? "" : autoProc.getRefinedCellBeta().toString(); String unitCell_gamma = autoProc == null ? "" : autoProc.getRefinedCellGamma().toString(); String resolutionRange = ""; String nTotalObservations = ""; String nTotalUniqueReflections = ""; String completeness = ""; String multiplicity = ""; String isigma = ""; String rmerge = ""; if (autoProcStatisticsOverall != null) { resolutionRange = autoProcStatisticsOverall.getResolutionLimitLow() + " - " + autoProcStatisticsOverall.getResolutionLimitHigh(); nTotalObservations = "" + autoProcStatisticsOverall.getnTotalObservations(); nTotalUniqueReflections = "" + (autoProcStatisticsOverall.getnTotalUniqueObservations() == null ? "" : autoProcStatisticsOverall.getnTotalUniqueObservations()); completeness = "" + autoProcStatisticsOverall.getCompleteness(); multiplicity = "" + autoProcStatisticsOverall.getMultiplicity(); isigma = "" + autoProcStatisticsOverall.getMeanIoverSigI(); rmerge = "" + (autoProcStatisticsOverall.getRmerge() == null ? "" : autoProcStatisticsOverall.getRmerge()); } if (autoProcStatisticsOuter != null) { resolutionRange += " (" + autoProcStatisticsOuter.getResolutionLimitLow() + " - " + autoProcStatisticsOuter.getResolutionLimitHigh() + ")"; nTotalObservations += " (" + autoProcStatisticsOuter.getnTotalObservations() + ")"; nTotalUniqueReflections += autoProcStatisticsOuter.getnTotalUniqueObservations() == null ? "" : (" (" + autoProcStatisticsOuter.getnTotalUniqueObservations() + ")"); completeness += " (" + autoProcStatisticsOuter.getCompleteness() + ")"; multiplicity += " (" + autoProcStatisticsOuter.getMultiplicity() + ")"; isigma += " (" + autoProcStatisticsOuter.getMeanIoverSigI() + ")"; rmerge += " (" + (autoProcStatisticsOuter.getRmerge() == null ? "" : autoProcStatisticsOuter.getRmerge()) + ")"; } // space group autoProcTable.addCell(new Paragraph("Space Group", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(spaceGroup, PdfRtfExporter.FONT_DOC_11)); // unit cell parameters autoProcTable.addCell( new Paragraph("Unit-cell parameters (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph("", PdfRtfExporter.FONT_DOC_11)); Paragraph pa = new Paragraph("\t a", PdfRtfExporter.FONT_DOC_11); pa.setAlignment(Element.ALIGN_JUSTIFIED); pa.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pa); autoProcTable.addCell(new Paragraph(unitCell_a, PdfRtfExporter.FONT_DOC_11)); Paragraph pb = new Paragraph("\t b", PdfRtfExporter.FONT_DOC_11); pb.setAlignment(Element.ALIGN_JUSTIFIED); pb.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pb); autoProcTable.addCell(new Paragraph(unitCell_b, PdfRtfExporter.FONT_DOC_11)); Paragraph pc = new Paragraph("\t c", PdfRtfExporter.FONT_DOC_11); pc.setAlignment(Element.ALIGN_JUSTIFIED); pc.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pc); autoProcTable.addCell(new Paragraph(unitCell_c, PdfRtfExporter.FONT_DOC_11)); // Issue 1733: cell angles info added Paragraph palpha = new Paragraph("\t alpha", PdfRtfExporter.FONT_DOC_11); palpha.setAlignment(Element.ALIGN_JUSTIFIED); palpha.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(palpha); autoProcTable.addCell(new Paragraph(unitCell_alpha, PdfRtfExporter.FONT_DOC_11)); Paragraph pbeta = new Paragraph("\t beta", PdfRtfExporter.FONT_DOC_11); pbeta.setAlignment(Element.ALIGN_JUSTIFIED); pbeta.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pbeta); autoProcTable.addCell(new Paragraph(unitCell_beta, PdfRtfExporter.FONT_DOC_11)); Paragraph pgamma = new Paragraph("\t gamma", PdfRtfExporter.FONT_DOC_11); pgamma.setAlignment(Element.ALIGN_JUSTIFIED); pgamma.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pgamma); autoProcTable.addCell(new Paragraph(unitCell_gamma, PdfRtfExporter.FONT_DOC_11)); // resolution range autoProcTable.addCell( new Paragraph("Resolution range (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(resolutionRange, PdfRtfExporter.FONT_DOC_11)); // Observed reflections autoProcTable.addCell(new Paragraph("Observed reflections", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(nTotalObservations, PdfRtfExporter.FONT_DOC_11)); // No. of unique reflections autoProcTable.addCell(new Paragraph("No. of unique reflections", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(nTotalUniqueReflections, PdfRtfExporter.FONT_DOC_11)); // Completeness autoProcTable.addCell(new Paragraph("Completeness (%)", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(completeness, PdfRtfExporter.FONT_DOC_11)); // multiplicity autoProcTable.addCell(new Paragraph("Multiplicity", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(multiplicity, PdfRtfExporter.FONT_DOC_11)); new Phrase(); // I/(I) Phrase p = Phrase.getInstance("<I/" + (char) 963 + "(I)>"); p.setFont(PdfRtfExporter.FONT_DOC_11); autoProcTable.addCell(p); autoProcTable.addCell(new Paragraph(isigma, PdfRtfExporter.FONT_DOC_11)); // Rmerge Chunk c1 = new Chunk("R", PdfRtfExporter.FONT_DOC_11); Chunk c2 = new Chunk("merge", PdfRtfExporter.FONT_DOC_EXPONENT); c2.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); Chunk c3 = new Chunk("(%)", PdfRtfExporter.FONT_DOC_11); Chunk c4 = new Chunk("#", PdfRtfExporter.FONT_DOC_EXPONENT_BLUE); c4.setTextRise(PdfRtfExporter.TEXT_RISE_EXP); Paragraph rMergeParagraph = new Paragraph(); rMergeParagraph.add(c1); rMergeParagraph.add(c2); rMergeParagraph.add(c3); rMergeParagraph.add(c4); autoProcTable.addCell(rMergeParagraph); autoProcTable.addCell(new Paragraph(rmerge, PdfRtfExporter.FONT_DOC_11)); document.add(autoProcTable); document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11)); // nota bene info Paragraph nbParagraph = new Paragraph(); nbParagraph.add(c4); nbParagraph.add(c1); nbParagraph.add(c2); Chunk cesp = new Chunk(" ", PdfRtfExporter.FONT_DOC_11); Chunk c5 = new Chunk(" = ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c5); Phrase pSigma = Phrase.getInstance("" + (char) 931); pSigma.setFont(PdfRtfExporter.FONT_DOC_11); nbParagraph.add(pSigma); Chunk chkl = new Chunk("hkl", PdfRtfExporter.FONT_DOC_EXPONENT); chkl.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(chkl); nbParagraph.add(cesp); nbParagraph.add(pSigma); Chunk ci = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT); ci.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(ci); Chunk c8 = new Chunk(" |I", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c8); nbParagraph.add(ci); Chunk c9 = new Chunk("(hkl) - (I(hkl))| / ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c9); nbParagraph.add(pSigma); nbParagraph.add(chkl); nbParagraph.add(cesp); nbParagraph.add(pSigma); nbParagraph.add(ci); nbParagraph.add(cesp); Chunk c10 = new Chunk("I", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c10); nbParagraph.add(ci); Chunk c11 = new Chunk("(hkl), where ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c11); Chunk c12 = new Chunk("I", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c12); Chunk cii = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT_ITALIC); cii.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(cii); Chunk c13 = new Chunk("(hkl)", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c13); Chunk c14 = new Chunk(" is the ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c14); Chunk c15 = new Chunk("i", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c15); Chunk c16 = new Chunk("th observation of reflection ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c16); Chunk chklI = new Chunk("hkl", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(chklI); Chunk c17 = new Chunk(" and ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c17); Chunk c18 = new Chunk("<I(hkl)> ", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c18); Chunk c19 = new Chunk(" is the weighted average intensity for all observations of reflection ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c19); nbParagraph.add(chklI); Chunk c20 = new Chunk(".", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c20); document.add(nbParagraph); document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11)); }
From source file:it.govpay.web.console.pagamenti.gde.exporter.PdfExporter.java
License:Open Source License
private static void addTitlePage(Document document) throws DocumentException { Paragraph preface = new Paragraph(); // We add one empty line addEmptyLine(preface, 1);//w w w . j a va 2 s .co m // Lets write a big header preface.add(new Paragraph("Eventi selezionati", catFont)); addEmptyLine(preface, 1); // Will create: Report generated by: _name, _date preface.add(new Paragraph("Report generated by: Govpay, " + new Date(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ smallBold)); addEmptyLine(preface, 3); preface.add(new Paragraph("Il report contiene gli eventi selezionati per l'export nella console Govpay.", smallBold)); document.add(preface); }
From source file:it.prato.comune.tolomeo.web.TolomeoPrintPDFServlet.java
License:Open Source License
private void print(String riga, Font font, Paragraph par, Document doc) throws Exception { try {//w w w .ja v a 2 s . c o m Phrase frase = new Phrase(riga + "\r\n", font); par.add(frase); doc.add(par); par.clear(); } catch (Exception e) { throw e; } }