List of usage examples for com.lowagie.text Paragraph add
public boolean add(Object o)
Object
to the Paragraph
. From source file:org.oscarehr.casemgmt.service.CaseManagementPrintPdf.java
License:Open Source License
public void printNotes(List<CaseManagementNote> notes) throws DocumentException { CaseManagementNote note;//from ww w . ja va 2 s . c o m Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Paragraph p; Phrase phrase; Chunk chunk; if (newPage) document.newPage(); else newPage = true; //Print notes for (int idx = 0; idx < notes.size(); ++idx) { note = notes.get(idx); p = new Paragraph(); //p.setSpacingBefore(font.leading(LINESPACING)*2f); phrase = new Phrase(LEADING, "", font); chunk = new Chunk("Documentation Date: " + formatter.format(note.getObservation_date()) + "\n", obsfont); phrase.add(chunk); phrase.add(note.getNote() + "\n\n"); p.add(phrase); document.add(p); } }
From source file:org.oscarehr.casemgmt.service.MeasurementPrint.java
License:Open Source License
@Override public void printExt(CaseManagementPrintPdf engine, HttpServletRequest request) throws IOException, DocumentException { logger.info("measurement print!!!!"); MeasurementsDao measurementsDao = (MeasurementsDao) SpringUtils.getBean("measurementsDao"); String startDate = request.getParameter("pStartDate"); String endDate = request.getParameter("pEndDate"); String demographicNo = request.getParameter("demographicNo"); logger.info("startDate = " + startDate); logger.info("endDate = " + endDate); logger.info("demographicNo = " + demographicNo); List<Measurements> measurements = null; if (startDate.equals("") && endDate.equals("")) { measurements = measurementsDao.getMeasurements(demographicNo); } else {// w ww. j a va2s . c o m try { SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); Date dStartDate = formatter.parse(startDate); Date dEndDate = formatter.parse(endDate); measurements = measurementsDao.getMeasurements(demographicNo, dStartDate, dEndDate); } catch (Exception e) { logger.error(e); } } if (engine.getNewPage()) engine.getDocument().newPage(); else engine.setNewPage(true); Font obsfont = new Font(engine.getBaseFont(), engine.FONTSIZE, Font.UNDERLINE); Paragraph p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_CENTER); Phrase phrase = new Phrase(engine.LEADING, "\n\n", engine.getFont()); p.add(phrase); phrase = new Phrase(engine.LEADING, "Measurements", obsfont); p.add(phrase); engine.getDocument().add(p); //go through each appt in reverge chronological order, and print the measurements String lastDate = null; PdfPTable table = null; for (Measurements measurement : measurements) { boolean newDate = false; String date = engine.getFormatter().format(measurement.getDateObserved()); if (lastDate == null) { lastDate = date; newDate = true; } else { if (!lastDate.equals(date)) { newDate = true; lastDate = date; } } if (newDate) { p = new Paragraph(); phrase = new Phrase(engine.LEADING, "", engine.getFont()); Chunk chunk = new Chunk("Documentation Date: " + engine.getFormatter().format(measurement.getDateObserved()) + "\n\n", obsfont); phrase.add(chunk); p.add(phrase); table = new PdfPTable(2); printMeasurementEntries(date, measurements, table); engine.getDocument().add(p); engine.getDocument().add(table); } // // engine.getDocument().add(table); } //engine.getDocument().add(p); }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printRx(String demoNo, List<CaseManagementNote> cpp) throws DocumentException { if (demoNo == null) return;//from w w w . j a v a 2 s. c o m /* if( newPage ) document.newPage(); else newPage = true; */ oscar.oscarRx.data.RxPrescriptionData prescriptData = new oscar.oscarRx.data.RxPrescriptionData(); oscar.oscarRx.data.RxPrescriptionData.Prescription[] arr = {}; arr = prescriptData.getUniquePrescriptionsByPatient(Integer.parseInt(demoNo)); if (arr.length == 0) { return; } Paragraph p = new Paragraph(); Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Phrase phrase = new Phrase(LEADING, "", obsfont); p.setAlignment(Paragraph.ALIGN_LEFT); phrase.add("Prescriptions"); p.add(phrase); document.add(p); Font normal = new Font(bf, FONTSIZE, Font.NORMAL); Font curFont; for (int idx = 0; idx < arr.length; ++idx) { oscar.oscarRx.data.RxPrescriptionData.Prescription drug = arr[idx]; p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); if (drug.isCurrent() && !drug.isArchived()) { curFont = normal; phrase = new Phrase(LEADING, "", curFont); phrase.add(formatter.format(drug.getRxDate()) + " - "); phrase.add(drug.getFullOutLine().replaceAll(";", " ")); p.add(phrase); document.add(p); } } if (cpp != null) { List<CaseManagementNote> notes = cpp; if (notes != null && notes.size() > 0) { p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); phrase = new Phrase(LEADING, "\nOther Meds\n", obsfont); //TODO:Needs to be i18n p.add(phrase); document.add(p); newPage = false; this.printNotes(notes); } } }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printCPPItem(String heading, Collection<CaseManagementNote> notes) throws DocumentException { if (newPage)/*w ww . j av a 2 s . c om*/ document.newPage(); // else // newPage = true; Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Paragraph p = null; Phrase phrase = null; p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); phrase = new Phrase(LEADING, heading, obsfont); p.add(phrase); document.add(p); newPage = false; this.printNotes(notes, true); // cb.endText(); }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printCPPItem(String heading, Measurements measurement) throws DocumentException { if (newPage)//from ww w . j av a2 s . c om document.newPage(); // else // newPage = true; Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Paragraph p = null; Phrase phrase = null; p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); phrase = new Phrase(LEADING, heading, obsfont); p.add(phrase); document.add(p); newPage = false; p = new Paragraph(); phrase = new Phrase(LEADING, "", font); //phrase.add(new Chunk(formatter.format(measurement.getDateObserved()) + ":")); phrase.add(measurement.getDataField() + "\n"); p.add(phrase); document.add(p); // cb.endText(); }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printNotes(Collection<CaseManagementNote> notes, boolean compact) throws DocumentException { CaseManagementNote note;//from w w w. ja v a2 s . c o m Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Paragraph p; Phrase phrase; Chunk chunk; //if( newPage ) // document.newPage(); // else // newPage = true; //Print notes Iterator<CaseManagementNote> notesIter = notes.iterator(); while (notesIter.hasNext()) { note = notesIter.next(); p = new Paragraph(); //p.setSpacingBefore(font.leading(LINESPACING)*2f); phrase = new Phrase(LEADING, "", font); if (compact) { phrase.add(new Chunk(formatter.format(note.getUpdate_date()) + ":")); } else { chunk = new Chunk("Impression/Plan: (" + formatter.format(note.getUpdate_date()) + ")\n", obsfont); phrase.add(chunk); } if (compact) { phrase.add(note.getNote() + "\n"); } else { phrase.add(note.getNote() + "\n\n"); } p.add(phrase); document.add(p); } }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printOcularProcedures(List<EyeformOcularProcedure> ocularProcedures) throws DocumentException { ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao"); /*//from w w w. j a v a 2 s.co m if( getNewPage() ) getDocument().newPage(); else setNewPage(true); */ Font obsfont = new Font(getBaseFont(), FONTSIZE, Font.UNDERLINE); Paragraph p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); Phrase phrase = new Phrase(LEADING, "\n", getFont()); p.add(phrase); phrase = new Phrase(LEADING, "Ocular Procedures", obsfont); p.add(phrase); getDocument().add(p); for (EyeformOcularProcedure proc : ocularProcedures) { p = new Paragraph(); phrase = new Phrase(LEADING, "", getFont()); //Chunk chunk = new Chunk("Documentation Date: " + getFormatter().format(proc.getDate()) + "\n", obsfont); Chunk chunk = new Chunk(getFormatter().format(proc.getDate()) + " " + proc.getEye() + " " + proc.getProcedureName() + " at " + proc.getLocation() + " by " + providerDao.getProviderName(proc.getDoctor()) + " " + proc.getProcedureNote() + "\n", getFont()); phrase.add(chunk); p.add(phrase); getDocument().add(p); } }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printSpecsHistory(List<EyeformSpecsHistory> specsHistory) throws DocumentException { ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao"); /*/*from w ww . j a va 2 s . c o m*/ if( getNewPage() ) getDocument().newPage(); else setNewPage(true); */ Font obsfont = new Font(getBaseFont(), FONTSIZE, Font.UNDERLINE); Paragraph p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); Phrase phrase = new Phrase(LEADING, "\n", getFont()); p.add(phrase); phrase = new Phrase(LEADING, "Specs History", obsfont); p.add(phrase); getDocument().add(p); PdfPTable table = new PdfPTable(2); table.getDefaultCell().setBorder(PdfPCell.NO_BORDER); table.setSpacingBefore(10f); table.setSpacingAfter(10f); table.setTotalWidth(new float[] { 10f, 60f }); table.setTotalWidth(5f); table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT); for (EyeformSpecsHistory specs : specsHistory) { PdfPCell cell1 = new PdfPCell(new Phrase(getFormatter().format(specs.getDate()), getFont())); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table.addCell(cell1); PdfPCell cell2 = new PdfPCell(new Phrase(specs.toString2(), getFont())); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table.addCell(cell2); } getDocument().add(table); }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printEyeformPlan(List<EyeformFollowUp> followUps, List<EyeformProcedureBook> procedureBooks, List<EyeformTestBook> testBooks, EyeForm eyeform) throws DocumentException { for (EyeformFollowUp followUp : followUps) { Paragraph p = new Paragraph(); p.add(getFormatter().format(followUp.getDate()) + ":" + followUp.getType() + " " + followUp.getTimespan() + " " + followUp.getTimeframe() + " " + followUp.getFollowupProvider() + " " + followUp.getUrgency() + "\n"); getDocument().add(p);/*from ww w . j a va 2 s . c o m*/ } for (EyeformProcedureBook proc : procedureBooks) { Paragraph p = new Paragraph(); p.add(getFormatter().format(proc.getDate()) + ":" + proc.getProcedureName() + "\n"); getDocument().add(p); } for (EyeformTestBook test : testBooks) { Paragraph p = new Paragraph(); p.add(getFormatter().format(test.getDate()) + ":" + test.getTestname() + "\n"); getDocument().add(p); } if (eyeform != null && eyeform.getDischarge() != null && eyeform.getDischarge().equals("true")) { Paragraph p = new Paragraph(); p.add("Patient is discharged from my active care.\n"); getDocument().add(p); } if (eyeform != null && eyeform.getOpt() != null && eyeform.getOpt().equals("true")) { Paragraph p = new Paragraph(); p.add("Routine eye care by an optometrist is recommended.\n"); getDocument().add(p); } if (eyeform != null && eyeform.getStat() != null && eyeform.getStat().equals("true")) { Paragraph p = new Paragraph(); p.add("Follow up as needed with me STAT or PRN if symptoms are worse.\n"); getDocument().add(p); } return; }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printEyeformMeasurements(MeasurementFormatter mf) throws DocumentException { /*/* w w w . ja v a2s . com*/ if( getNewPage() ) getDocument().newPage(); else setNewPage(true); */ Font obsfont = new Font(getBaseFont(), FONTSIZE, Font.UNDERLINE); Paragraph p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); Phrase phrase = new Phrase(LEADING, "\n", getFont()); // p.add(phrase); phrase = new Phrase(LEADING, "Ocular Examination", obsfont); p.add(phrase); getDocument().add(p); p = new Paragraph(); boolean addVisionAssessment = false; p.add(new Phrase("VISION ASSESSMENT: ", getFont())); if (mf.getVisionAssessmentAutoRefraction().length() > 0) { p.add(new Phrase("Auto-refraction ", boldFont)); p.add(new Phrase(mf.getVisionAssessmentAutoRefraction(), getFont())); addVisionAssessment = true; } if (mf.getVisionAssessmentKeratometry().length() > 0) { p.add(new Phrase(" Keratometry ", boldFont)); p.add(new Phrase(mf.getVisionAssessmentKeratometry(), getFont())); addVisionAssessment = true; } if (mf.getVisionAssessmentVision("distance", "sc").length() > 0) { p.add(new Phrase(" Distance vision (sc) ", boldFont)); p.add(new Phrase(mf.getVisionAssessmentVision("distance", "sc"), getFont())); addVisionAssessment = true; } if (mf.getVisionAssessmentVision("distance", "cc").length() > 0) { p.add(new Phrase(" Distance vision (cc) ", boldFont)); p.add(new Phrase(mf.getVisionAssessmentVision("distance", "cc"), getFont())); addVisionAssessment = true; } if (mf.getVisionAssessmentVision("distance", "ph").length() > 0) { p.add(new Phrase(" Distance vision (ph) ", boldFont)); p.add(new Phrase(mf.getVisionAssessmentVision("distance", "ph"), getFont())); addVisionAssessment = true; } if (mf.getVisionAssessmentVision("near", "sc").length() > 0) { p.add(new Phrase(" Near vision (sc) ", boldFont)); p.add(new Phrase(mf.getVisionAssessmentVision("near", "sc"), getFont())); addVisionAssessment = true; } if (mf.getVisionAssessmentVision("near", "cc").length() > 0) { p.add(new Phrase(" Near vision (cc) ", boldFont)); p.add(new Phrase(mf.getVisionAssessmentVision("near", "cc"), getFont())); addVisionAssessment = true; } p.add(new Phrase("\n\n")); if (addVisionAssessment) { getDocument().add(p); } p = new Paragraph(); boolean addManifestVision = false; p.add(new Phrase("MANIFEST VISION: ", getFont())); if (mf.getManifestDistance().length() > 0) { p.add(new Phrase("Manifest distance ", boldFont)); p.add(new Phrase(mf.getManifestDistance(), getFont())); addManifestVision = true; } if (mf.getManifestNear().length() > 0) { p.add(new Phrase(" Manifest near ", boldFont)); p.add(new Phrase(mf.getManifestNear(), getFont())); addManifestVision = true; } if (mf.getCycloplegicRefraction().length() > 0) { p.add(new Phrase(" Cycloplegic refraction ", boldFont)); p.add(new Phrase(mf.getCycloplegicRefraction(), getFont())); addManifestVision = true; } p.add(new Phrase("\n\n")); if (addManifestVision) { getDocument().add(p); } p = new Paragraph(); boolean addIop = false; p.add(new Phrase("INTRAOCULAR PRESSURE: ", getFont())); if (mf.getNCT().length() > 0) { p.add(new Phrase("NCT ", boldFont)); p.add(new Phrase(mf.getNCT(), getFont())); addIop = true; } if (mf.getApplanation().length() > 0) { p.add(new Phrase(" Applanation ", boldFont)); p.add(new Phrase(mf.getApplanation(), getFont())); addIop = true; } if (mf.getCCT().length() > 0) { p.add(new Phrase(" Central corneal thickness ", boldFont)); p.add(new Phrase(mf.getCCT(), getFont())); addIop = true; } p.add(new Phrase("\n\n")); if (addIop) { getDocument().add(p); } p = new Paragraph(); boolean addOtherExam = false; p.add(new Phrase("OTHER EXAM: ", getFont())); if (mf.getColourVision().length() > 0) { p.add(new Phrase("Colour vision ", boldFont)); p.add(new Phrase(mf.getColourVision(), getFont())); addOtherExam = true; } if (mf.getPupil().length() > 0) { p.add(new Phrase(" Pupil ", boldFont)); p.add(new Phrase(mf.getPupil(), getFont())); addOtherExam = true; } if (mf.getAmslerGrid().length() > 0) { p.add(new Phrase(" Amsler grid ", boldFont)); p.add(new Phrase(mf.getAmslerGrid(), getFont())); addOtherExam = true; } if (mf.getPAM().length() > 0) { p.add(new Phrase(" Potential acuity meter ", boldFont)); p.add(new Phrase(mf.getPAM(), getFont())); addOtherExam = true; } if (mf.getConfrontation().length() > 0) { p.add(new Phrase(" Confrontation fields ", boldFont)); p.add(new Phrase(mf.getConfrontation(), getFont())); addOtherExam = true; } p.add(new Phrase("\n\n")); if (addOtherExam) { getDocument().add(p); } p = new Paragraph(); boolean addEom = false; p.add(new Phrase("EOM/STEREO: ", getFont())); if (mf.getEomStereo().length() > 0) { p.add(new Phrase(mf.getEomStereo(), getFont())); addEom = true; } p.add(new Phrase("\n\n")); if (addEom) { getDocument().add(p); } p = new Paragraph(); boolean addAnteriorSegment = false; p.add(new Phrase("ANTERIOR SEGMENT: ", getFont())); if (mf.getCornea().length() > 0) { p.add(new Phrase("Cornea ", boldFont)); p.add(new Phrase(mf.getCornea(), getFont())); addAnteriorSegment = true; } if (mf.getConjuctivaSclera().length() > 0) { p.add(new Phrase(" Conjunctiva/Sclera ", boldFont)); p.add(new Phrase(mf.getConjuctivaSclera(), getFont())); addAnteriorSegment = true; } if (mf.getAnteriorChamber().length() > 0) { p.add(new Phrase(" Anterior chamber ", boldFont)); p.add(new Phrase(mf.getAnteriorChamber(), getFont())); addAnteriorSegment = true; } if (mf.getAngle().length() > 0) { p.add(new Phrase(" Angle ", boldFont)); p.add(new Phrase(mf.getAngle(), getFont())); addAnteriorSegment = true; } if (mf.getIris().length() > 0) { p.add(new Phrase(" Iris ", boldFont)); p.add(new Phrase(mf.getIris(), getFont())); addAnteriorSegment = true; } if (mf.getLens().length() > 0) { p.add(new Phrase(" Lens ", boldFont)); p.add(new Phrase(mf.getLens(), getFont())); addAnteriorSegment = true; } p.add(new Phrase("\n\n")); if (addAnteriorSegment) { getDocument().add(p); } p = new Paragraph(); boolean addPosteriorSegment = false; p.add(new Phrase("POSTERIOR SEGMENT: ", getFont())); if (mf.getDisc().length() > 0) { p.add(new Phrase("Optic disc ", boldFont)); p.add(new Phrase(mf.getDisc(), getFont())); addPosteriorSegment = true; } if (mf.getCdRatio().length() > 0) { p.add(new Phrase(" C/D ratio ", boldFont)); p.add(new Phrase(mf.getCdRatio(), getFont())); addPosteriorSegment = true; } if (mf.getMacula().length() > 0) { p.add(new Phrase(" Macula ", boldFont)); p.add(new Phrase(mf.getMacula(), getFont())); addPosteriorSegment = true; } if (mf.getRetina().length() > 0) { p.add(new Phrase(" Retina ", boldFont)); p.add(new Phrase(mf.getRetina(), getFont())); addPosteriorSegment = true; } if (mf.getVitreous().length() > 0) { p.add(new Phrase(" Vitreous ", boldFont)); p.add(new Phrase(mf.getVitreous(), getFont())); addPosteriorSegment = true; } p.add(new Phrase("\n\n")); if (addPosteriorSegment) { getDocument().add(p); } p = new Paragraph(); boolean addExternal = false; p.add(new Phrase("EXTERNAL/ORBIT: ", getFont())); if (mf.getFace().length() > 0) { p.add(new Phrase("Face ", boldFont)); p.add(new Phrase(mf.getFace(), getFont())); addExternal = true; } if (mf.getUpperLid().length() > 0) { p.add(new Phrase(" Upper lid ", boldFont)); p.add(new Phrase(mf.getUpperLid(), getFont())); addExternal = true; } if (mf.getLowerLid().length() > 0) { p.add(new Phrase(" Lower lid ", boldFont)); p.add(new Phrase(mf.getLowerLid(), getFont())); addExternal = true; } if (mf.getPunctum().length() > 0) { p.add(new Phrase(" Punctum ", boldFont)); p.add(new Phrase(mf.getPunctum(), getFont())); addExternal = true; } if (mf.getLacrimalLake().length() > 0) { p.add(new Phrase(" Lacrimal lake ", boldFont)); p.add(new Phrase(mf.getLacrimalLake(), getFont())); addExternal = true; } if (mf.getRetropulsion().length() > 0) { p.add(new Phrase(" Retropulsion ", boldFont)); p.add(new Phrase(mf.getRetropulsion(), getFont())); addExternal = true; } if (mf.getHertel().length() > 0) { p.add(new Phrase(" Hertel ", boldFont)); p.add(new Phrase(mf.getHertel(), getFont())); addExternal = true; } p.add(new Phrase("\n\n")); if (addExternal) { getDocument().add(p); } p = new Paragraph(); boolean addNasolacrimal = false; p.add(new Phrase("NASOLACRIMAL DUCT: ", getFont())); if (mf.getLacrimalIrrigation().length() > 0) { p.add(new Phrase("Lacrimal irrigation ", boldFont)); p.add(new Phrase(mf.getLacrimalIrrigation(), getFont())); addNasolacrimal = true; } if (mf.getNLD().length() > 0) { p.add(new Phrase(" Nasolacrimal duct ", boldFont)); p.add(new Phrase(mf.getNLD(), getFont())); addNasolacrimal = true; } if (mf.getDyeDisappearance().length() > 0) { p.add(new Phrase(" Dye disappearance ", boldFont)); p.add(new Phrase(mf.getDyeDisappearance(), getFont())); addNasolacrimal = true; } p.add(new Phrase("\n\n")); if (addNasolacrimal) { getDocument().add(p); } p = new Paragraph(); boolean addEyelidMeasurement = false; p.add(new Phrase("EYELID MEASUREMENT: ", getFont())); if (mf.getMarginReflexDistance().length() > 0) { p.add(new Phrase("Margin reflex distance ", boldFont)); p.add(new Phrase(mf.getMarginReflexDistance(), getFont())); addEyelidMeasurement = true; } if (mf.getLevatorFunction().length() > 0) { p.add(new Phrase(" Levator function ", boldFont)); p.add(new Phrase(mf.getLevatorFunction(), getFont())); addEyelidMeasurement = true; } if (mf.getInferiorScleralShow().length() > 0) { p.add(new Phrase(" Inferior scleral show ", boldFont)); p.add(new Phrase(mf.getInferiorScleralShow(), getFont())); addEyelidMeasurement = true; } if (mf.getLagophthalmos().length() > 0) { p.add(new Phrase(" Lagophthalmos ", boldFont)); p.add(new Phrase(mf.getLagophthalmos(), getFont())); addEyelidMeasurement = true; } if (mf.getBlink().length() > 0) { p.add(new Phrase(" Blink ", boldFont)); p.add(new Phrase(mf.getBlink(), getFont())); addEyelidMeasurement = true; } if (mf.getCNVii().length() > 0) { p.add(new Phrase(" Cranial Nerve VII function ", boldFont)); p.add(new Phrase(mf.getCNVii(), getFont())); addEyelidMeasurement = true; } if (mf.getBells().length() > 0) { p.add(new Phrase(" Bell's phenonmenon ", boldFont)); p.add(new Phrase(mf.getBells(), getFont())); addEyelidMeasurement = true; } p.add(new Phrase("\n\n")); if (addEyelidMeasurement) { getDocument().add(p); } }