List of usage examples for com.lowagie.text Paragraph setAlignment
public void setAlignment(String alignment)
From source file:org.oscarehr.casemgmt.service.CaseManagementPrintPdf.java
License:Open Source License
public void printCPP(HashMap<String, List<CaseManagementNote>> cpp) throws DocumentException { if (cpp == null) return;// w ww . j a v a2 s . c o m if (newPage) document.newPage(); else newPage = true; Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Paragraph p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_CENTER); Phrase phrase = new Phrase(LEADING, "\n\n", font); p.add(phrase); phrase = new Phrase(LEADING, "Patient CPP", obsfont); p.add(phrase); document.add(p); //upperYcoord -= p.leading() * 2f; //lworkingYcoord = rworkingYcoord = upperYcoord; //ColumnText ct = new ColumnText(cb); String[] headings = { "Social History\n", "Other Meds\n", "Medical History\n", "Ongoing Concerns\n", "Reminders\n", "Family History\n", "Risk Factors\n" }; String[] issueCodes = { "SocHistory", "OMeds", "MedHistory", "Concerns", "Reminders", "FamHistory", "RiskFactors" }; //String[] content = {cpp.getSocialHistory(), cpp.getFamilyHistory(), cpp.getMedicalHistory(), cpp.getOngoingConcerns(), cpp.getReminders()}; //init column to left side of page //ct.setSimpleColumn(document.left(), document.bottomMargin()+25f, document.right()/2f, lworkingYcoord); //int column = 1; //Chunk chunk; //float bottom = document.bottomMargin()+25f; //float middle; //bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); //cb.beginText(); //String headerContd; //while there are cpp headings to process for (int idx = 0; idx < headings.length; ++idx) { p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); phrase = new Phrase(LEADING, headings[idx], obsfont); p.add(phrase); document.add(p); newPage = false; this.printNotes(cpp.get(issueCodes[idx])); } //phrase.add(content[idx]); //ct.addText(phrase); // //do we need a page break? check if we're within a fudge factor of the bottom // if( lworkingYcoord <= (bottom * 1.1) && rworkingYcoord <= (bottom*1.1) ) { // document.newPage(); // rworkingYcoord = lworkingYcoord = document.top(); // } // // //Are we in right column? if so, flip over to left column if there is room // if( column % 2 == 1 ) { // if( lworkingYcoord > bottom ) { // ct.setSimpleColumn(document.left(), bottom, (document.right()/2f)-10f, lworkingYcoord); // ++column; // } // } // //Are we in left column? if so, flip over to right column only if text will fit // else { // ct.setSimpleColumn((document.right()/2f)+10f, bottom, document.right(), rworkingYcoord); // // if( ct.go(true) == ColumnText.NO_MORE_COLUMN ) { // ct.setSimpleColumn(document.left(), bottom, (document.right()/2f)-10f, lworkingYcoord); // } // else { // ct.setYLine(rworkingYcoord); // ++column; // } // // //ct.go(true) consumes input so we reload // phrase = new Phrase(LEADING, "", font); // chunk = new Chunk(headings[idx], obsfont); // phrase.add(chunk); // phrase.add(content[idx]); // ct.setText(phrase); // } // // //while there is text to write, fill columns/page break when page full // while( ct.go() == ColumnText.NO_MORE_COLUMN ) { // if( column % 2 == 0 ) { // lworkingYcoord = bottom; // middle = (document.right()/4f)*3f; // headerContd = headings[idx] + " cont'd"; // cb.setFontAndSize(bf, FONTSIZE); // cb.showTextAligned(PdfContentByte.ALIGN_CENTER, headerContd, middle, rworkingYcoord-phrase.leading(), 0f); // //cb.showTextAligned(PdfContentByte.ALIGN_CENTER, headings[idx] + " cont'd", middle, rworkingYcoord, 0f); // rworkingYcoord -= phrase.leading(); // ct.setSimpleColumn((document.right()/2f)+10f, bottom, document.right(), rworkingYcoord); // } // else { // document.newPage(); // rworkingYcoord = lworkingYcoord = document.top(); // middle = (document.right()/4f); // headerContd = headings[idx] + " cont'd"; // cb.setFontAndSize(bf, FONTSIZE); // cb.showTextAligned(PdfContentByte.ALIGN_CENTER, headerContd, middle, lworkingYcoord-phrase.leading(), 0f); // lworkingYcoord -= phrase.leading(); // ct.setSimpleColumn(document.left(), bottom, (document.right()/2f)-10f, lworkingYcoord); // } // ++column; // } // // if( column % 2 == 0 ) // lworkingYcoord -= (ct.getLinesWritten() * ct.getLeading() + (ct.getLeading() * 2f)); // else // rworkingYcoord -= (ct.getLinesWritten() * ct.getLeading() + (ct.getLeading() * 2f)); // } // cb.endText(); }
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 {/*from w w w.ja va 2s.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 printDocHeaderFooter() throws DocumentException { document.resetHeader();/* w w w . j av a2 s.com*/ document.resetFooter(); //document.resetPageCount(); String headerTitle = demographic.getFormattedName() + " " + demographic.getAge() + " " + demographic.getSex() + " DOB:" + demographic.getFormattedDob(); //set up document title and header ResourceBundle propResource = ResourceBundle.getBundle("oscarResources"); String title = propResource.getString("oscarEncounter.pdfPrint.title") + " " + (String) request.getAttribute("demoName") + "\n"; String gender = propResource.getString("oscarEncounter.pdfPrint.gender") + " " + (String) request.getAttribute("demoSex") + "\n"; String dob = propResource.getString("oscarEncounter.pdfPrint.dob") + " " + (String) request.getAttribute("demoDOB") + "\n"; String age = propResource.getString("oscarEncounter.pdfPrint.age") + " " + (String) request.getAttribute("demoAge") + "\n"; String mrp = propResource.getString("oscarEncounter.pdfPrint.mrp") + " " + (String) request.getAttribute("mrp") + "\n"; String[] info = new String[] { title, gender, dob, age, mrp }; ClinicData clinicData = new ClinicData(); clinicData.refreshClinicData(); String[] clinic = new String[] { clinicData.getClinicName(), clinicData.getClinicAddress(), clinicData.getClinicCity() + ", " + clinicData.getClinicProvince(), clinicData.getClinicPostal(), clinicData.getClinicPhone() }; if (newPage) { document.newPage(); newPage = false; } //Header will be printed at top of every page beginning with p2 Phrase headerPhrase = new Phrase(LEADING, headerTitle, boldFont); /* HeaderFooter header = new HeaderFooter(headerPhrase,false); header.setAlignment(HeaderFooter.ALIGN_CENTER); document.setHeader(header); */ getDocument().add(headerPhrase); getDocument().add(new Phrase("\n")); Paragraph p = new Paragraph("Tel:" + demographic.getPhone(), getFont()); p.setAlignment(Paragraph.ALIGN_LEFT); // getDocument().add(p); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Paragraph p2 = new Paragraph("Date of Visit: " + sdf.format(appointment.getAppointmentDate()), getFont()); p2.setAlignment(Paragraph.ALIGN_RIGHT); // getDocument().add(p); PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100f); table.getDefaultCell().setBorder(PdfPCell.NO_BORDER); PdfPCell cell1 = new PdfPCell(p); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_LEFT); PdfPCell cell2 = new PdfPCell(p2); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); cell2.setBorder(PdfPCell.NO_BORDER); table.addCell(cell1); table.addCell(cell2); getDocument().add(table); table = new PdfPTable(3); table.setWidthPercentage(100f); table.getDefaultCell().setBorder(PdfPCell.NO_BORDER); cell1 = new PdfPCell(getParagraph("Signed Provider:" + ((signingProvider != null) ? signingProvider : ""))); cell1.setBorder(PdfPCell.BOTTOM); cell1.setHorizontalAlignment(Element.ALIGN_LEFT); cell2 = new PdfPCell(getParagraph("RFR:" + this.appointment.getReason())); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setBorder(PdfPCell.BOTTOM); PdfPCell cell3 = new PdfPCell(getParagraph("Ref:" + this.getRefName(this.demographic))); cell3.setHorizontalAlignment(Element.ALIGN_RIGHT); cell3.setBorder(PdfPCell.BOTTOM); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); getDocument().add(table); /* HeaderFooter footer = new HeaderFooter(new Phrase("-",font),new Phrase("-",font)); footer.setAlignment(HeaderFooter.ALIGN_CENTER); footer.setBorder(0); document.setFooter(footer); */ //Write title with top and bottom borders on p1 // cb = writer.getDirectContent(); /* cb.setColorStroke(new Color(0,0,0)); cb.setLineWidth(0.5f); * cb.moveTo(document.left(), document.top() - (font.getCalculatedLeading(LINESPACING)*5f)); cb.lineTo(document.right(), document.top() - (font.getCalculatedLeading(LINESPACING)*5f)); cb.stroke(); */ }
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 ww .j a v a2s .co 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)/*from w w w.j a v a 2 s. c o m*/ 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 w w w.j a v a 2 s . c o m 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 printOcularProcedures(List<EyeformOcularProcedure> ocularProcedures) throws DocumentException { ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao"); /*/* w w w .j a v a2 s.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 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 ww w . j a va 2 s .c om*/ 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 printEyeformMeasurements(MeasurementFormatter mf) throws DocumentException { /*//from w w w . j a v a 2 s . 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); } }
From source file:org.oscarehr.common.service.PdfRecordPrinter.java
License:Open Source License
public void printPhotos(String contextPath, List<org.oscarehr.common.model.Document> photos) throws DocumentException { writer.setStrictImageSequence(true); if (photos.size() > 0) { Font obsfont = new Font(getBaseFont(), FONTSIZE, Font.UNDERLINE); Paragraph p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); Phrase phrase = new Phrase(LEADING, "\n\n", getFont()); p.add(phrase);//from www . j a v a 2 s .c o m phrase = new Phrase(LEADING, "Photos:", obsfont); p.add(phrase); getDocument().add(p); } for (org.oscarehr.common.model.Document doc : photos) { Image img = null; try { // String location = oscar.OscarProperties.getInstance().getProperty("DOCUMENT_DIR").trim() + doc.getDocfilename(); String location = EDocUtil.getDocumentPath(doc.getDocfilename()); logger.info("adding image " + location); img = Image.getInstance(location); } catch (IOException e) { MiscUtils.getLogger().error("error:", e); continue; } img.scaleToFit(getDocument().getPageSize().getWidth() - getDocument().leftMargin() - getDocument().rightMargin(), getDocument().getPageSize().getHeight()); Chunk chunk = new Chunk(img, getDocument().getPageSize().getWidth() - getDocument().leftMargin() - getDocument().rightMargin(), getDocument().getPageSize().getHeight()); Paragraph p = new Paragraph(); p.add(img); p.add(new Phrase("Description:" + doc.getDocdesc(), getFont())); getDocument().add(p); } }