List of usage examples for com.itextpdf.text.pdf PdfPTable getDefaultCell
public PdfPCell getDefaultCell()
PdfPCell
that will be used as reference for all the addCell
methods except addCell(PdfPCell)
. From source file:fc.extensions.itext.Writer.java
License:MIT License
public void addEmptyCell(PdfPTable table, float borderWidth) { table.getDefaultCell().setBorderWidth(borderWidth); table.addCell(""); }
From source file:femr.ui.controllers.PDFController.java
License:Open Source License
/** * Builds the page header - Title and Empty cell (for border) * * @return PdfPTable the itext table to add to the document *///from www . j a v a 2s.c o m public PdfPTable createHeaderTable() { PdfPTable table = new PdfPTable(2); table.setSpacingAfter(10); table.setWidthPercentage(100); Paragraph title = new Paragraph("Medical Record", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD)); PdfPCell cell = new PdfPCell(title); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); cell.setBorder(PdfPCell.NO_BORDER); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderWidthBottom(1); cell.setPaddingBottom(5); table.addCell(cell); //Paragraph encounterId = new Paragraph("Encounter ID: " + patientEncounter.getId(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); cell = new PdfPCell(table.getDefaultCell()); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); cell.setBorder(PdfPCell.NO_BORDER); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderWidthBottom(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); return table; }
From source file:femr.ui.controllers.PDFController.java
License:Open Source License
/** * Builds the Encounter Info Table - The names and dates of each stage of the encounter * * @param encounter the encounter item// w ww . j a va 2 s .co m * @return PdfPTable the itext table to add to the document */ private PdfPTable createEncounterInfoTable(PatientEncounterItem encounter) { PdfPTable table = getDefaultTable(3); table.addCell(getDefaultHeaderCell("Encounter Information", 3)); // // Nurse // PdfPCell cell = new PdfPCell(table.getDefaultCell()); // Paragraph title = new Paragraph("Nurse:", getTitleFont()); // Paragraph value = new Paragraph(outputStringOrNA(encounter.getNurseEmailAddress()), getValueFont()); // cell.addElement(title); // cell.addElement(value); // table.addCell(cell); // // // Physician // cell = new PdfPCell(table.getDefaultCell()); // title = new Paragraph("Physician:", getTitleFont()); // value = new Paragraph(outputStringOrNA(encounter.getPhysicianEmailAddress()), getValueFont()); // cell.addElement(title); // cell.addElement(value); // table.addCell(cell); // // // Pharmacist // cell = new PdfPCell(table.getDefaultCell()); // title = new Paragraph("Pharmacist:", getTitleFont()); // value = new Paragraph(outputStringOrNA(encounter.getPharmacistEmailAddress()), getValueFont()); // cell.addElement(title); // cell.addElement(value); // table.addCell(cell); // Nurse PdfPCell cell = new PdfPCell(table.getDefaultCell()); Paragraph title = new Paragraph("Nurse:", getTitleFont()); Paragraph value = new Paragraph(outputStringOrNA(encounter.getNurseFullName()), getValueFont()); //Andrew Change cell.addElement(title); cell.addElement(value); table.addCell(cell); // Physician cell = new PdfPCell(table.getDefaultCell()); title = new Paragraph("Physician:", getTitleFont()); value = new Paragraph(outputStringOrNA(encounter.getPhysicianFullName()), getValueFont()); //Andrew Change cell.addElement(title); cell.addElement(value); table.addCell(cell); // Pharmacist cell = new PdfPCell(table.getDefaultCell()); title = new Paragraph("Pharmacist:", getTitleFont()); value = new Paragraph(outputStringOrNA(encounter.getPharmacistFullName()), getValueFont()); //Andrew Change cell.addElement(title); cell.addElement(value); table.addCell(cell); // Triage cell = new PdfPCell(table.getDefaultCell()); title = new Paragraph("Triage Visit:", getTitleFont()); value = new Paragraph(outputStringOrNA(encounter.getTriageDateOfVisit()), getValueFont()); cell.addElement(title); cell.addElement(value); table.addCell(cell); // Medical cell = new PdfPCell(table.getDefaultCell()); title = new Paragraph("Medical Visit:", getTitleFont()); value = new Paragraph(outputStringOrNA(encounter.getMedicalDateOfVisit()), getValueFont()); cell.addElement(title); cell.addElement(value); table.addCell(cell); // Pharmacy cell = new PdfPCell(table.getDefaultCell()); title = new Paragraph("Pharmacy Visit:", getTitleFont()); value = new Paragraph(outputStringOrNA(encounter.getPharmacyDateOfVisit()), getValueFont()); cell.addElement(title); cell.addElement(value); table.addCell(cell); return table; }
From source file:femr.ui.controllers.PDFController.java
License:Open Source License
/** * Builds the Vitals Table - The vitals of the encounter * * @param encounter the encounter item//from w w w . j av a 2 s . c o m * @param vitalMap the map of the vital values * @return PdfPTable the itext table to add to the document */ private PdfPTable createVitalsTable(PatientEncounterItem encounter, VitalMultiMap vitalMap) { PdfPTable table = getDefaultTable(3); table.addCell(getDefaultHeaderCell("Patient Vitals", 3)); table.addCell(getVitalMapCell("Blood Pressure: ", "bloodPressure", vitalMap)); table.addCell(getVitalMapCell("Temperature:", "temperature", vitalMap)); table.addCell(getVitalMapCell("Glucose:", "glucose", vitalMap)); table.addCell(getVitalMapCell("Heart Rate: ", "bloodPressure", vitalMap)); table.addCell(getVitalMapCell("Respiration Rate:", "respiratoryRate", vitalMap)); table.addCell(getVitalMapCell("Oxygen Saturation:", "oxygenSaturation", vitalMap)); //Sam Zanni PdfPCell cell = new PdfPCell(table.getDefaultCell()); cell.setPaddingTop(2); table.addCell(getVitalMapCell("Weeks Pregnant:", "weeksPregnant", vitalMap)); table.completeRow(); return table; }
From source file:femr.ui.controllers.PDFController.java
License:Open Source License
/** * Builds the Assessments Table - The assessment fields for the encounter * * @param tabFieldMultiMap multimap of the encounter's tab fields * @param prescriptionItems a list of the encounter's prescriptions * @param problemItems a list of the encounter's problems * @return PdfPTable the itext table to add to the document */// www. j a v a 2 s . c o m private PdfPTable getAssessments(TabFieldMultiMap tabFieldMultiMap, List<PrescriptionItem> prescriptionItems, List<ProblemItem> problemItems) { PdfPTable table = getDefaultTable(3); //Set table to span 3 columns to counteract tablesize for dispensed prescriptions table.addCell(getDefaultHeaderCell("Assessments", 3)); // Row 1 PdfPCell cellMSH = new PdfPCell(table.getDefaultCell()); TabFieldItem msh = tabFieldMultiMap.getMostRecentOrEmpty("medicalSurgicalHistory", null); cellMSH.addElement(getStyledPhrase("Medical Surgical History: ", outputStringOrNA(msh.getValue()))); cellMSH.setColspan(3); table.addCell(cellMSH); // Row 2 PdfPCell cellCM = new PdfPCell(table.getDefaultCell()); TabFieldItem cm = tabFieldMultiMap.getMostRecentOrEmpty("currentMedication", null); cellCM.addElement(getStyledPhrase("Medication: ", outputStringOrNA(cm.getValue()))); cellCM.setColspan(3); table.addCell(cellCM); // Row 3 PdfPCell cellSH = new PdfPCell(table.getDefaultCell()); TabFieldItem sh = tabFieldMultiMap.getMostRecentOrEmpty("socialHistory", null); cellSH.addElement(getStyledPhrase("Social History: ", outputStringOrNA(sh.getValue()))); cellSH.setColspan(3); table.addCell(cellSH); // Row 4 PdfPCell cellAssesment = new PdfPCell(table.getDefaultCell()); TabFieldItem assessment = tabFieldMultiMap.getMostRecentOrEmpty("assessment", null); cellAssesment.addElement(getStyledPhrase("Assessment: ", outputStringOrNA(assessment.getValue()))); cellAssesment.setColspan(3); table.addCell(cellAssesment); // Row 5 PdfPCell cellFH = new PdfPCell(table.getDefaultCell()); TabFieldItem fh = tabFieldMultiMap.getMostRecentOrEmpty("familyHistory", null); cellFH.addElement(getStyledPhrase("Family History: ", outputStringOrNA(fh.getValue()))); cellFH.setColspan(3); table.addCell(cellFH); // Row 6 PdfPCell cellTreatment = new PdfPCell(table.getDefaultCell()); TabFieldItem treatment = tabFieldMultiMap.getMostRecentOrEmpty("procedure_counseling", null); cellTreatment.addElement(getStyledPhrase("Procedure/Counseling: ", outputStringOrNA(treatment.getValue()))); cellTreatment.setColspan(3); table.addCell(cellTreatment); // Loop through and add any potential Custom Field Names // Row 7+ , set cells to colspan of 2 so they fill the whole page for (String customField : tabFieldMultiMap.getCustomFieldNameList()) { String value = tabFieldMultiMap.getMostRecentOrEmpty(customField, null).getValue(); PdfPCell customCell = new PdfPCell(table.getDefaultCell()); customCell.setColspan(3); customCell.addElement(getStyledPhrase(customField + " :", outputStringOrNA(value))); table.addCell(customCell); } // AJ Saclayan Dispensed Table Paragraph prescriptionsTitle = new Paragraph("Dispensed Prescription(s):", getTitleFont()); PdfPCell prescriptionCell = new PdfPCell(table.getDefaultCell()); prescriptionCell.setPaddingRight(10); prescriptionCell.addElement(prescriptionsTitle); prescriptionCell.setColspan(3); table.addCell(prescriptionCell); table.completeRow(); if (!prescriptionItems.isEmpty()) { //Create Dispensed Table. Paragraph originalMedsTitle = new Paragraph("Original", getTitleFont()); PdfPCell cell = new PdfPCell(originalMedsTitle); table.addCell(cell); Paragraph replacedMedsTitle = new Paragraph("Replacement", getTitleFont()); cell = new PdfPCell(replacedMedsTitle); table.addCell(cell); table.completeRow(); for (PrescriptionItem prescription : prescriptionItems) { String medicationForm = prescription.getMedicationForm(); if (medicationForm == null || medicationForm.equals("")) { medicationForm = "N/A"; } else { medicationForm = medicationForm.trim(); } if (prescription.getReplacementMedicationName() != null) { Paragraph originalMedName = new Paragraph( "Prescription #" + prescription.getId() + " - Replaced \n" + prescription.getAmount() + " " + prescription.getName() + " (" + medicationForm + ")", getValueFont()); cell = new PdfPCell(originalMedName); table.addCell(cell); Paragraph replacedMedName = new Paragraph("Prescription #" + prescription.getReplacementId() + " \n" + prescription.getReplacementAmount() + " " + prescription.getReplacementMedicationName(), getValueFont()); cell = new PdfPCell(replacedMedName); table.addCell(cell); } else { Paragraph medName = new Paragraph("Prescription #" + prescription.getId() + "\n" + prescription.getAmount() + " " + prescription.getName() + " (" + medicationForm + ")", getValueFont()); cell = new PdfPCell(medName); table.addCell(cell); Paragraph blankCell = new Paragraph(" ", getValueFont()); cell = new PdfPCell(blankCell); table.addCell(cell); } table.completeRow(); } } // Get Problems Paragraph problemsTitle = new Paragraph("Problem(s):", getTitleFont()); PdfPCell problemsCell = new PdfPCell(table.getDefaultCell()); problemsCell.addElement(problemsTitle); for (ProblemItem problem : problemItems) { Paragraph probText = new Paragraph(" - " + problem.getName(), getValueFont()); problemsCell.addElement(probText); } table.addCell(problemsCell); table.completeRow(); return table; }
From source file:femr.ui.controllers.PDFController.java
License:Open Source License
/** * Adds the fields for the cheif complaint to the passed in table * * @param table the PdfPTable object to add the rows to * @param chiefComplaint the chief complaint as a string or null * @param tabFieldMultiMap multimap of the encounter's tab fields *//*from www . j a va 2 s . c o m*/ private void addChiefComplaintSectionToTable(PdfPTable table, String chiefComplaint, TabFieldMultiMap tabFieldMultiMap) { PdfPCell cellCC = new PdfPCell(table.getDefaultCell()); cellCC.addElement(getStyledPhrase("Chief Complaint: ", outputStringOrNA(chiefComplaint))); cellCC.setColspan(2); table.addCell(cellCC); // Known Field Names // Put styled phrase into a cell, then add it to the table PdfPCell onsetC = new PdfPCell(table.getDefaultCell()); onsetC.addElement(getStyledPhrase("Onset: ", outputStringOrNA(tabFieldMultiMap.getMostRecentOrEmpty("onset", chiefComplaint).getValue()))); table.addCell(onsetC); PdfPCell fieldCell = new PdfPCell(table.getDefaultCell()); fieldCell.setPaddingRight(5); fieldCell.addElement(getStyledPhrase("Quality: ", outputStringOrNA(tabFieldMultiMap.getMostRecentOrEmpty("quality", chiefComplaint).getValue()))); table.addCell(fieldCell); fieldCell = new PdfPCell(table.getDefaultCell()); fieldCell.setPaddingRight(5); fieldCell.addElement(getStyledPhrase("Severity: ", outputStringOrNA(tabFieldMultiMap.getMostRecentOrEmpty("severity", chiefComplaint).getValue()))); table.addCell(fieldCell); fieldCell = new PdfPCell(table.getDefaultCell()); fieldCell.setPaddingRight(5); fieldCell.addElement(getStyledPhrase("Provokes: ", outputStringOrNA(tabFieldMultiMap.getMostRecentOrEmpty("provokes", chiefComplaint).getValue()))); table.addCell(fieldCell); fieldCell = new PdfPCell(table.getDefaultCell()); fieldCell.setPaddingRight(5); fieldCell.addElement(getStyledPhrase("Palliates: ", outputStringOrNA(tabFieldMultiMap.getMostRecentOrEmpty("palliates", chiefComplaint).getValue()))); table.addCell(fieldCell); fieldCell = new PdfPCell(table.getDefaultCell()); fieldCell.setPaddingRight(5); fieldCell.addElement(getStyledPhrase("TimeOfDay: ", outputStringOrNA(tabFieldMultiMap.getMostRecentOrEmpty("timeOfDay", chiefComplaint).getValue()))); table.addCell(fieldCell); fieldCell = new PdfPCell(table.getDefaultCell()); fieldCell.setPaddingRight(5); fieldCell.addElement(getStyledPhrase("Radiation: ", outputStringOrNA(tabFieldMultiMap.getMostRecentOrEmpty("radiation", chiefComplaint).getValue()))); table.addCell(fieldCell); // Physical Examination PdfPCell cellPE = new PdfPCell(table.getDefaultCell()); TabFieldItem fieldItem = tabFieldMultiMap.getMostRecentOrEmpty("physicalExamination", chiefComplaint); cellPE.addElement(getStyledPhrase("Physical Examination: ", outputStringOrNA(fieldItem.getValue()))); cellPE.setColspan(2); table.addCell(cellPE); // Narrative PdfPCell cellNarrative = new PdfPCell(table.getDefaultCell()); fieldItem = tabFieldMultiMap.getMostRecentOrEmpty("narrative", chiefComplaint); cellNarrative.addElement(getStyledPhrase("Narrative: ", outputStringOrNA(fieldItem.getValue()))); cellNarrative.setColspan(2); table.addCell(cellNarrative); // add an empty row to add spacing between chief complaints table.addCell(" "); table.completeRow(); }
From source file:femr.ui.controllers.PDFController.java
License:Open Source License
/** * Builds a table with numColumns with the base stylins * @param numColumns the number of columns the table will have * @return an instantiated PdfPTable object *///from w w w .j a v a 2 s .c o m private PdfPTable getDefaultTable(int numColumns) { PdfPTable table = new PdfPTable(numColumns); table.setWidthPercentage(100); table.setSpacingAfter(10); table.getDefaultCell().setPaddingBottom(5); table.getDefaultCell().setBorder(PdfPCell.NO_BORDER); return table; }
From source file:fenix.planner.pdf.PDFGenerator.java
License:Open Source License
private void createAndAddEventTable() throws DocumentException { PdfPTable table = new PdfPTable(new float[] { 1, 7, 1.2f }); table.setWidthPercentage(100f);//from ww w . ja v a2s.c o m table.getDefaultCell().setUseAscender(true); table.getDefaultCell().setUseDescender(true); table.setSpacingBefore(20); table.setSpacingAfter(20); // Header row table.getDefaultCell().setBorderWidthLeft(0); table.getDefaultCell().setBorderWidthTop(0); table.getDefaultCell().setBorderWidthRight(0); table.getDefaultCell().setPadding(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(new Phrase("Datum", headerFont)); table.addCell(new Phrase("mne", headerFont)); table.addCell(new Phrase("Ansvarig", headerFont)); table.setHeaderRows(1); table.getDefaultCell().setBackgroundColor(null); // Events for (Event event : program.getSortedCopyOfEvents()) { if (event.getDate().getMonthOfYear() % 2 == 0) { table.getDefaultCell().setBackgroundColor(new BaseColor(0xdd, 0xdd, 0xdd)); } else { table.getDefaultCell().setBackgroundColor(null); } if (!event.getType().getBackgroundColor().equals(Color.WHITE)) { table.getDefaultCell() .setBackgroundColor(awtColorToBaseColor(event.getType().getBackgroundColor())); } final BaseColor textColor = awtColorToBaseColor(event.getType().getForegroundColor()); PdfPCell dateCell = new PdfPCell(table.getDefaultCell()); dateCell.addElement( new Phrase(event.getDate().toString("dd.MM", locale), changeColor(subjectFont, textColor))); table.addCell(dateCell); PdfPCell subjectCell = new PdfPCell(table.getDefaultCell()); subjectCell.addElement(new Phrase(event.getSubject(), changeColor(subjectFont, textColor))); if (event.getDescription().length() > 0) { subjectCell.addElement(new Phrase(event.getDescription(), changeColor(descriptionFont, textColor))); } if (event.getOrganizer() == null) { subjectCell.setColspan(2); } table.addCell(subjectCell); if (event.getOrganizer() != null) { PdfPCell organizerCell = new PdfPCell(table.getDefaultCell()); organizerCell.addElement( new Phrase(event.getOrganizer().getInitials(), changeColor(subjectFont, textColor))); table.addCell(organizerCell); } } document.add(table); }
From source file:fenix.planner.pdf.PDFGenerator.java
License:Open Source License
private void createAndAddOrganizerTable() throws DocumentException { PdfPTable table = new PdfPTable(new float[] { 1, 3, 4, 2 }); table.setSpacingBefore(20);//w w w . j a va2 s . c om table.setWidthPercentage(100f); table.getDefaultCell().setUseAscender(true); table.getDefaultCell().setUseDescender(true); // Header row table.getDefaultCell().setBorder(0); table.getDefaultCell().setPadding(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setBackgroundColor(null); for (Organizer organizer : program.getSortedCopyOfOrganizers()) { table.addCell(new Phrase(organizer.getInitials(), organizerFont)); table.addCell(new Phrase(organizer.getFullName(), organizerFont)); table.addCell(new Phrase(organizer.getEmail(), organizerFont)); table.addCell(new Phrase(organizer.getPhoneNumber(), organizerFont)); } document.add(table); }
From source file:fll.web.playoff.ScoresheetGenerator.java
License:Open Source License
public void writeFile(final OutputStream out, final boolean orientationIsPortrait) throws DocumentException { // This creates our new PDF document and declares its orientation Document pdfDoc;/*from w w w . j ava 2s. c om*/ if (orientationIsPortrait) { pdfDoc = new Document(PageSize.LETTER); // portrait } else { pdfDoc = new Document(PageSize.LETTER.rotate()); // landscape } PdfWriter.getInstance(pdfDoc, out); // Measurements are always in points (72 per inch) // This sets up 1/2 inch margins side margins and 0.35in top and bottom // margins pdfDoc.setMargins(0.5f * POINTS_PER_INCH, 0.5f * POINTS_PER_INCH, 0.35f * POINTS_PER_INCH, 0.35f * POINTS_PER_INCH); pdfDoc.open(); // Header cell with challenge title to add to both scoresheets final Paragraph titleParagraph = new Paragraph(); final Chunk titleChunk = new Chunk(m_pageTitle, FontFactory.getFont(FontFactory.HELVETICA_BOLD, 14, Font.NORMAL, BaseColor.WHITE)); titleParagraph.setAlignment(Element.ALIGN_CENTER); titleParagraph.add(titleChunk); titleParagraph.add(Chunk.NEWLINE); final Chunk swVersionChunk = new Chunk("SW version: " + Version.getVersion(), FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL, BaseColor.WHITE)); titleParagraph.add(swVersionChunk); if (null != m_revision) { final Chunk revisionChunk = new Chunk(" Descriptor revision: " + m_revision, FontFactory.getFont(FontFactory.HELVETICA, 8, Font.NORMAL, BaseColor.WHITE)); titleParagraph.add(revisionChunk); } final PdfPCell head = new PdfPCell(); head.setColspan(2); head.setBorder(1); head.setPaddingTop(0); head.setPaddingBottom(3); head.setBackgroundColor(new BaseColor(64, 64, 64)); head.setVerticalAlignment(Element.ALIGN_TOP); head.addElement(titleParagraph); // Cells for score field, and 2nd check initials final Phrase des = new Phrase("Data Entry Score _______", ARIAL_8PT_NORMAL); final PdfPCell desC = new PdfPCell(des); desC.setBorder(0); desC.setPaddingTop(9); desC.setPaddingRight(36); desC.setHorizontalAlignment(Element.ALIGN_RIGHT); final Phrase sci = new Phrase("2nd Check Initials _______", ARIAL_8PT_NORMAL); final PdfPCell sciC = new PdfPCell(sci); sciC.setBorder(0); sciC.setPaddingTop(9); sciC.setPaddingRight(36); sciC.setHorizontalAlignment(Element.ALIGN_RIGHT); // Create a table with a grid cell for each scoresheet on the page PdfPTable wholePage = getTableForPage(orientationIsPortrait); wholePage.setWidthPercentage(100); for (int i = 0; i < m_numSheets; i++) { if (i > 0 && (orientationIsPortrait || (i % 2) == 0)) { pdfDoc.newPage(); wholePage = getTableForPage(orientationIsPortrait); wholePage.setWidthPercentage(100); } // This table is a single score sheet final PdfPTable scoreSheet = new PdfPTable(2); // scoreSheet.getDefaultCell().setBorder(Rectangle.LEFT | Rectangle.BOTTOM // | Rectangle.RIGHT | Rectangle.TOP); //FIXME DEBUG should be NO_BORDER scoreSheet.getDefaultCell().setBorder(Rectangle.NO_BORDER); scoreSheet.getDefaultCell().setPaddingRight(1); scoreSheet.getDefaultCell().setPaddingLeft(0); scoreSheet.addCell(head); final PdfPTable teamInfo = new PdfPTable(7); teamInfo.setWidthPercentage(100); teamInfo.setWidths(new float[] { 1f, 1f, 1f, 1f, 1f, 1f, .9f }); // Time label cell final Paragraph timeP = new Paragraph("Time:", ARIAL_10PT_NORMAL); timeP.setAlignment(Element.ALIGN_RIGHT); final PdfPCell timeLc = new PdfPCell(scoreSheet.getDefaultCell()); timeLc.addElement(timeP); teamInfo.addCell(timeLc); // Time value cell final Paragraph timeV = new Paragraph(null == m_time[i] ? SHORT_BLANK : m_time[i], COURIER_10PT_NORMAL); final PdfPCell timeVc = new PdfPCell(scoreSheet.getDefaultCell()); timeVc.addElement(timeV); teamInfo.addCell(timeVc); // Table label cell final Paragraph tblP = new Paragraph("Table:", ARIAL_10PT_NORMAL); tblP.setAlignment(Element.ALIGN_RIGHT); final PdfPCell tblLc = new PdfPCell(scoreSheet.getDefaultCell()); tblLc.addElement(tblP); teamInfo.addCell(tblLc); // Table value cell final Paragraph tblV = new Paragraph(m_table[i], COURIER_10PT_NORMAL); final PdfPCell tblVc = new PdfPCell(scoreSheet.getDefaultCell()); tblVc.addElement(tblV); teamInfo.addCell(tblVc); // Round number label cell final Paragraph rndP = new Paragraph("Round:", ARIAL_10PT_NORMAL); rndP.setAlignment(Element.ALIGN_RIGHT); final PdfPCell rndlc = new PdfPCell(scoreSheet.getDefaultCell()); rndlc.addElement(rndP); teamInfo.addCell(rndlc); // Round number value cell final Paragraph rndV = new Paragraph(m_round[i], COURIER_10PT_NORMAL); final PdfPCell rndVc = new PdfPCell(scoreSheet.getDefaultCell()); // rndVc.setColspan(2); rndVc.addElement(rndV); teamInfo.addCell(rndVc); final PdfPCell temp1 = new PdfPCell(scoreSheet.getDefaultCell()); // temp1.setColspan(2); temp1.addElement(new Paragraph("Judge ____", ARIAL_8PT_NORMAL)); teamInfo.addCell(temp1); // Team number label cell final Paragraph nbrP = new Paragraph("Team #:", ARIAL_10PT_NORMAL); nbrP.setAlignment(Element.ALIGN_RIGHT); final PdfPCell nbrlc = new PdfPCell(scoreSheet.getDefaultCell()); nbrlc.addElement(nbrP); teamInfo.addCell(nbrlc); // Team number value cell final Paragraph nbrV = new Paragraph(null == m_number[i] ? SHORT_BLANK : String.valueOf(m_number[i]), COURIER_10PT_NORMAL); final PdfPCell nbrVc = new PdfPCell(scoreSheet.getDefaultCell()); nbrVc.addElement(nbrV); teamInfo.addCell(nbrVc); // Team division label cell final Paragraph divP = new Paragraph(m_divisionLabel[i], ARIAL_10PT_NORMAL); divP.setAlignment(Element.ALIGN_RIGHT); final PdfPCell divlc = new PdfPCell(scoreSheet.getDefaultCell()); divlc.addElement(divP); divlc.setColspan(2); teamInfo.addCell(divlc); // Team division value cell final Paragraph divV = new Paragraph(m_division[i], COURIER_10PT_NORMAL); final PdfPCell divVc = new PdfPCell(scoreSheet.getDefaultCell()); divVc.setColspan(2); divVc.addElement(divV); teamInfo.addCell(divVc); final PdfPCell temp2 = new PdfPCell(scoreSheet.getDefaultCell()); // temp2.setColspan(2); temp2.addElement(new Paragraph("Team ____", ARIAL_8PT_NORMAL)); teamInfo.addCell(temp2); // Team name label cell final Paragraph nameP = new Paragraph("Team Name:", ARIAL_10PT_NORMAL); nameP.setAlignment(Element.ALIGN_RIGHT); final PdfPCell namelc = new PdfPCell(scoreSheet.getDefaultCell()); namelc.setColspan(2); namelc.addElement(nameP); teamInfo.addCell(namelc); // Team name value cell final Paragraph nameV = new Paragraph(m_name[i], COURIER_10PT_NORMAL); final PdfPCell nameVc = new PdfPCell(scoreSheet.getDefaultCell()); nameVc.setColspan(5); nameVc.addElement(nameV); teamInfo.addCell(nameVc); // add team info cell to the team table final PdfPCell teamInfoCell = new PdfPCell(scoreSheet.getDefaultCell()); teamInfoCell.addElement(teamInfo); teamInfoCell.setColspan(2); scoreSheet.addCell(teamInfoCell); if (null != m_goalsTable) { final PdfPCell goalCell = new PdfPCell(m_goalsTable); goalCell.setBorder(0); goalCell.setPadding(0); goalCell.setColspan(2); scoreSheet.addCell(goalCell); } scoreSheet.addCell(desC); scoreSheet.addCell(sciC); if (null != m_copyright) { final Phrase copyright = new Phrase("\u00A9" + m_copyright, f6i); final PdfPCell copyrightC = new PdfPCell(scoreSheet.getDefaultCell()); copyrightC.addElement(copyright); copyrightC.setBorder(0); copyrightC.setHorizontalAlignment(Element.ALIGN_CENTER); copyrightC.setColspan(2); scoreSheet.addCell(copyrightC); } // the cell in the whole page table that will contain the single score // sheet final PdfPCell scoresheetCell = new PdfPCell(scoreSheet); scoresheetCell.setBorder(0); scoresheetCell.setPadding(0); // Interior borders between scoresheets on a page if (!orientationIsPortrait) { if (i % 2 == 0) { scoresheetCell.setPaddingRight(0.1f * POINTS_PER_INCH); } else { scoresheetCell.setPaddingLeft(0.1f * POINTS_PER_INCH); } } // Add the current scoresheet to the page wholePage.addCell(scoresheetCell); // Add the current table of scoresheets to the document if (orientationIsPortrait || (i % 2 != 0)) { pdfDoc.add(wholePage); } } // Add a blank cells to complete the table of the last page if (!orientationIsPortrait && m_numSheets % 2 != 0) { final PdfPCell blank = new PdfPCell(); blank.setBorder(0); wholePage.addCell(blank); pdfDoc.add(wholePage); } pdfDoc.close(); }