List of usage examples for com.lowagie.text.pdf PdfPCell setBorderWidthTop
public void setBorderWidthTop(float borderWidthTop)
From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java
License:Open Source License
public PdfPCell createCell() { PdfPCell cell = new PdfPCell(); cell.setBorderColor(sBorderColor);//from w w w .j av a 2 s. c om cell.setPadding(3); cell.setBorderWidth(0); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(1); cell.setBorderWidthBottom(1); cell.setBorderWidthLeft(1); cell.setBorderWidthRight(1); return cell; }
From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java
License:Open Source License
public void printHeaderCell(String name, boolean vertical, boolean eod, boolean eol) { PdfPCell c = createCell(); if (!eol && !eod) c.setBorderWidthRight(0);// ww w .j a v a2 s . co m if (name == null) { c.setBorderWidthLeft(0); c.setBorderWidthTop(0); c.setBorderWidthBottom(0); } else { addText(c, name); } iPdfTable.addCell(c); }
From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java
License:Open Source License
public void printCell(ExamGridModel model, int day, int slot, int idx, int maxIdx, boolean head, boolean vertical, boolean in, boolean eod, boolean eol) { ExamPeriod period = getPeriod(day, slot); ExamGridCell cell = model.getAssignment(period, idx); PdfPCell c = createCell(); c.setBorderWidthTop(head || (!in && !vertical) ? 1 : 0); c.setBorderWidthRight(eod || eol ? 1 : 0); if (cell == null) { String bgColor = model.getBackground(period); if (bgColor == null && !model.isAvailable(period)) bgColor = sBgColorNotAvailable; if (period == null) bgColor = sBgColorNotAvailable; if (bgColor != null) c.setBackgroundColor(getColor(bgColor)); c.setBorderWidthBottom(idx < maxIdx ? 0 : 1); addText(c, " "); } else {/*from w w w. j av a2 s . c om*/ String bgColor = cell.getBackground(); if (iForm.getBackground() == sBgNone && !sBgColorNotAvailable.equals(bgColor)) { if (!model.isAvailable(period)) bgColor = sBgColorNotAvailableButAssigned; } if (bgColor != null) c.setBackgroundColor(getColor(bgColor)); addText(c, cell.getName()); if (iForm.getResource() != sResourceRoom) addText(c, cell.getRoomName()); else addText(c, cell.getShortCommentNoColors() == null ? "" : cell.getShortCommentNoColors()); } iPdfTable.addCell(c); }
From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java
License:Open Source License
public void printRowHeaderCell(String name, int idx, int maxIdx, boolean vertical, boolean head, boolean in) { PdfPCell c = createCell(); c.setBorderWidthTop(idx == 0 && (head || (!in && !vertical)) ? 1 : 0); c.setBorderWidthBottom(idx < maxIdx ? 0 : 1); c.setBorderWidthRight(0);//from w w w. j a v a2 s . c om if (idx == 0) addText(c, name); iPdfTable.addCell(c); }
From source file:org.unitime.timetable.webutil.timegrid.PdfTimetableGridTable.java
License:Open Source License
public void printToPdf(TimetableGridModel model, int rowNumber) throws Exception { model.clearRendered();/* ww w.ja v a2s. co m*/ if (iTable.isDispModePerWeek()) { createTable(); printHeader(model, 0); } else { if (rowNumber == 0) { createTable(); printHeader(model, 0); } } if (iTable.isDispModeInRow()) { int maxIdx = model.getMaxIdxForDay(iDay, iTable.firstSlot(), iTable.lastSlot()); for (int idx = 0; idx <= maxIdx; idx++) { PdfPCell c = createCell(); c.setBorderWidthTop(0); if (idx == 0) addText(c, model.getName() + (model.getSize() > 0 ? " (" + model.getSize() + ")" : ""), true); c.setBorderWidthBottom(idx == maxIdx ? 1 : 0); c.setColspan(12); iPdfTable.addCell(c); for (int slot = iTable.firstSlot(); slot <= iTable.lastSlot(); slot++) { int slotsToEnd = iTable.lastSlot() - slot + 1; TimetableGridCell cell = model.getCell(iDay, slot, idx); int length = (cell == null ? 1 : cell.getLength() + cell.getSlot() - slot); int colSpan = (cell == null ? 1 : Math.min(length, slotsToEnd)); if (cell == null) { String bgColor = model.getBackground(iDay, slot); if (bgColor == null && !model.isAvailable(iDay, slot)) bgColor = TimetableGridCell.sBgColorNotAvailable; c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthBottom( idx == maxIdx ? 1 : model.getCell(iDay, slot, idx + 1) != null ? 1 : 0); c.setBorderWidthLeft(0); boolean eod = (slot == iTable.lastSlot()); boolean in = !eod && model.getCell(iDay, slot + 1, idx) == null && ((slot + 1 - iTable.firstSlot()) % iTable.nrSlotsPerPeriod()) != 0; c.setBorderWidthRight(eod || !in ? 1 : 0); c.setColspan(colSpan); if (bgColor != null) c.setBackgroundColor(getColor(bgColor)); iPdfTable.addCell(c); } else { String bgColor = cell.getBackground(); if (iTable.getBgMode() == TimetableGridModel.sBgModeNone) { for (int i = 0; i < length; i++) if (!model.isAvailable(iDay, slot + i)) { bgColor = TimetableGridCell.sBgColorNotAvailableButAssigned; break; } } c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthLeft(0); c.setColspan(colSpan); c.setBackgroundColor(getColor(bgColor)); addText(c, cell.getName()); if (iTable.getShowTimes()) addText(c, cell.getTime()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeRoom) addText(c, cell.getRoomName()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeInstructor && iTable.getShowInstructors() && !cell.getInstructor().isEmpty()) addText(c, cell.getInstructor()); if (iTable.getShowComments()) addText(c, cell.getShortCommentNoColors() == null ? null : cell.getShortCommentNoColors()); if (iTable.getWeek() == -100 && cell.hasDays() && !cell.getDays().equals(iTable.getDefaultDatePatternName())) addText(c, cell.getDays()); iPdfTable.addCell(c); slot += length - 1; } } } } else if (iTable.isDispModePerWeekHorizontal()) { for (int day = iTable.startDay(); day <= iTable.endDay(); day++) { int maxIdx = model.getMaxIdxForDay(day, iTable.firstSlot(), iTable.lastSlot()); for (int idx = 0; idx <= maxIdx; idx++) { PdfPCell c = createCell(); c.setBorderWidthTop(0); if (idx == 0) addText(c, Constants.DAY_NAME[day], true); c.setBorderWidthBottom(idx == maxIdx ? 1 : 0); c.setColspan(12); iPdfTable.addCell(c); for (int slot = iTable.firstSlot(); slot <= iTable.lastSlot(); slot++) { int slotsToEnd = iTable.lastSlot() - slot + 1; TimetableGridCell cell = model.getCell(day, slot, idx); int length = (cell == null ? 1 : cell.getLength() + cell.getSlot() - slot); int colSpan = (cell == null ? 1 : Math.min(length, slotsToEnd)); if (cell == null) { String bgColor = model.getBackground(day, slot); if (bgColor == null && !model.isAvailable(day, slot)) bgColor = TimetableGridCell.sBgColorNotAvailable; c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthBottom( idx == maxIdx ? 1 : model.getCell(day, slot, idx + 1) != null ? 1 : 0); c.setBorderWidthLeft(0); boolean eod = (slot == iTable.lastSlot()); boolean in = !eod && model.getCell(day, slot + 1, idx) == null && ((slot + 1 - iTable.firstSlot()) % iTable.nrSlotsPerPeriod()) != 0; c.setBorderWidthRight(eod || !in ? 1 : 0); iPdfTable.addCell(c); } else { String bgColor = cell.getBackground(); if (iTable.getBgMode() == TimetableGridModel.sBgModeNone) { for (int i = 0; i < length; i++) if (!model.isAvailable(day, slot + i)) { bgColor = TimetableGridCell.sBgColorNotAvailableButAssigned; break; } } c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthLeft(0); c.setColspan(colSpan); if (bgColor != null) c.setBackgroundColor(getColor(bgColor)); addText(c, cell.getName()); if (iTable.getShowTimes()) addText(c, cell.getTime()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeRoom) addText(c, cell.getRoomName()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeInstructor && iTable.getShowInstructors() && !cell.getInstructor().isEmpty()) addText(c, cell.getInstructor()); if (iTable.getShowComments()) addText(c, cell.getShortCommentNoColors() == null ? null : cell.getShortCommentNoColors()); if (iTable.getWeek() == -100 && cell.hasDays() && !cell.getDays().equals(iTable.getDefaultDatePatternName())) addText(c, cell.getDays()); iPdfTable.addCell(c); slot += length - 1; } } } } } else if (iTable.isDispModeWeekByWeekHorizontal()) { Calendar cal = Calendar.getInstance(Locale.US); cal.setTime(iTable.iFirstDate); for (int d = 0; d < 365; d++) { if (d > 0) cal.add(Calendar.DAY_OF_YEAR, 1); int date = d + iTable.iFirstDay; if (model.getFirstDay() >= 0 && (date < model.getFirstDay() || date > model.getFirstDay() + 6)) continue; int day = d % 7; if (day < iTable.startDay() || day > iTable.endDay()) continue; boolean hasClasses = false; for (int slot = iTable.firstSlot(); slot <= iTable.lastSlot(); slot++) { if (model.getCell(day, slot, 0, date) != null) { hasClasses = true; break; } } if (!hasClasses) continue; int maxIdx = model.getMaxIdxForDay(day, iTable.firstSlot(), iTable.lastSlot(), date); for (int idx = 0; idx <= maxIdx; idx++) { PdfPCell c = createCell(); c.setBorderWidthTop(0); if (idx == 0) addText(c, Constants.DAY_NAME[day] + " " + sDF.format(cal.getTime()), true); c.setBorderWidthBottom(idx == maxIdx ? 1 : 0); c.setColspan(12); iPdfTable.addCell(c); for (int slot = iTable.firstSlot(); slot <= iTable.lastSlot(); slot++) { int slotsToEnd = iTable.lastSlot() - slot + 1; TimetableGridCell cell = model.getCell(day, slot, idx, date); int length = (cell == null ? 1 : cell.getLength() + cell.getSlot() - slot); int colSpan = (cell == null ? 1 : Math.min(length, slotsToEnd)); if (cell == null) { String bgColor = model.getBackground(day, slot); if (bgColor == null && !model.isAvailable(day, slot)) bgColor = TimetableGridCell.sBgColorNotAvailable; c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthBottom( idx == maxIdx ? 1 : model.getCell(day, slot, idx + 1, date) != null ? 1 : 0); c.setBorderWidthLeft(0); boolean eod = (slot == iTable.lastSlot()); boolean in = !eod && model.getCell(day, slot + 1, idx, date) == null && ((slot + 1 - iTable.firstSlot()) % iTable.nrSlotsPerPeriod()) != 0; c.setBorderWidthRight(eod || !in ? 1 : 0); iPdfTable.addCell(c); } else { String bgColor = cell.getBackground(); if (iTable.getBgMode() == TimetableGridModel.sBgModeNone) { for (int i = 0; i < length; i++) if (!model.isAvailable(day, slot + i)) { bgColor = TimetableGridCell.sBgColorNotAvailableButAssigned; break; } } c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthLeft(0); c.setColspan(colSpan); if (bgColor != null) c.setBackgroundColor(getColor(bgColor)); addText(c, cell.getName()); if (iTable.getShowTimes()) addText(c, cell.getTime()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeRoom) addText(c, cell.getRoomName()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeInstructor && iTable.getShowInstructors() && !cell.getInstructor().isEmpty()) addText(c, cell.getInstructor()); if (iTable.getShowComments()) addText(c, cell.getShortCommentNoColors() == null ? null : cell.getShortCommentNoColors()); iPdfTable.addCell(c); slot += length - 1; } } } } } else { //isDispModePerWeekVertical for (int day = iTable.startDay(); day <= iTable.endDay(); day++) { int maxIdx = model.getMaxIdxForDay(day, iTable.firstSlot(), iTable.lastSlot()); for (int idx = 0; idx <= maxIdx; idx++) { PdfPCell c = null; for (int slot = iTable.lastSlot(); slot >= iTable.firstSlot(); slot--) { int slotsToEnd = slot + 1 - iTable.firstSlot(); TimetableGridCell cell = model.getCell(day, slot, idx); int length = (cell == null ? 1 : 1 + slot - cell.getSlot()); int colSpan = (cell == null ? 1 : Math.min(length, slotsToEnd)); if (cell == null) { String bgColor = model.getBackground(day, slot); if (bgColor == null && !model.isAvailable(day, slot)) bgColor = TimetableGridCell.sBgColorNotAvailable; c = createCell(); c.setBorderWidthTop(0); c.setMinimumHeight(100f); c.setBorderWidthBottom( idx == maxIdx ? 1 : model.getCell(day, slot, idx + 1) != null ? 1 : 0); c.setBorderWidthLeft(slot == iTable.lastSlot() ? 1 : 0); boolean eod = (slot == iTable.firstSlot()); boolean in = !eod && model.getCell(day, slot - 1, idx) == null && ((slot - iTable.firstSlot()) % iTable.nrSlotsPerPeriod()) != 0; c.setBorderWidthRight(eod || !in ? 1 : 0); iPdfTable.addCell(c); } else { String bgColor = cell.getBackground(); if (iTable.getBgMode() == TimetableGridModel.sBgModeNone) { for (int i = 0; i < length; i++) if (!model.isAvailable(day, slot - i)) { bgColor = TimetableGridCell.sBgColorNotAvailableButAssigned; break; } } c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthLeft(slot == iTable.lastSlot() ? 1 : 0); c.setColspan(colSpan); if (bgColor != null) c.setBackgroundColor(getColor(bgColor)); if (iTable.getWeek() == -100 && cell.hasDays() && !cell.getDays().equals(iTable.getDefaultDatePatternName())) addTextVertical(c, cell.getDays()); if (iTable.getShowTimes()) addText(c, cell.getTime()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeRoom) addTextVertical(c, cell.getRoomName()); if (iTable.getResourceType() != TimetableGridModel.sResourceTypeInstructor && iTable.getShowInstructors() && !cell.getInstructor().isEmpty()) addTextVertical(c, cell.getInstructor()); if (iTable.getShowComments()) addTextVertical(c, cell.getShortCommentNoColors() == null ? null : cell.getShortCommentNoColors()); addTextVertical(c, cell.getName()); iPdfTable.addCell(c); slot -= length - 1; } } c = createCell(); c.setBorderWidthTop(0); c.setBorderWidthLeft(0); if (idx == 0) addTextVertical(c, Constants.DAY_NAME[day], true); c.setBorderWidthBottom(idx == maxIdx ? 1 : 0); c.setColspan(12); iPdfTable.addCell(c); } } /* int step = iTable.nrSlotsPerPeriod(); for (int slot=iTable.firstSlot();slot<=iTable.lastSlot();slot+=step) { int time = slot * Constants.SLOT_LENGTH_MIN + Constants.FIRST_SLOT_TIME_MIN; int slotsToEnd = iTable.lastSlot()-slot+1; if ((slot%iTable.nrSlotsPerPeriod()) == 0) { c = createCell("TimetableHeadCell"+(slot==iTable.firstSlot()?"":"In")+"Vertical"); addText(c, Constants.toTime(time), true); iPdfTable.addCell(c); } else { c = createCell("TimetableHeadCellInVertical"); iPdfTable.addCell(c); } for (int day=iTable.startDay();day<=iTable.endDay();day++) { int maxIdx = model.getMaxIdxForDay(day,iTable.firstSlot(),iTable.lastSlot()); for (int idx=0;idx<=maxIdx;idx++) { TimetableGridCell cell = model.getCell(day,slot, idx); if (model.isRendered(day,slot,idx)) continue; int rowSpan = (cell==null?1:Math.min(cell.getLength()+cell.getSlot()-slot,slotsToEnd)); int colSpan = (iTable.getResourceType()==TimetableGridModel.sResourceTypeDepartment && cell!=null?1:model.getDepth(day,slot,idx,maxIdx,rowSpan)); model.setRendered(day,slot,idx,colSpan,rowSpan); int rowSpanDivStep = (int)Math.ceil(((double)rowSpan)/step); if (cell==null) { String bgColor = model.getBackground(day,slot); if (bgColor==null && !model.isAvailable(day,slot)) bgColor=TimetableGridCell.sBgColorNotAvailable; boolean eol = (day==iTable.endDay() && (idx+colSpan-1)==maxIdx); c = createCell("TimetableCell"+(slot==iTable.firstSlot()?"":"In")+"Vertical"+(eol?"EOL":"")); c.setColspan(colSpan); //c.setRowspan(rowSpanDivStep); if (bgColor!=null) c.setBackgroundColor(getColor(bgColor)); iPdfTable.addCell(c); } else { String bgColor = cell.getBackground(); if (iTable.getBgMode()==TimetableGridModel.sBgModeNone) { for (int i=0;i<cell.getLength();i++) if (!model.isAvailable(day,slot+i)) { bgColor = TimetableGridCell.sBgColorNotAvailableButAssigned; break; } } boolean eol = (day==iTable.endDay()); c = createCell("TimetableCell"+(slot==iTable.firstSlot()?"":"In")+"Vertical" + (eol?"EOL":"")); c.setColspan(colSpan); //c.setRowspan(rowSpanDivStep); if (bgColor!=null) c.setBackgroundColor(getColor(bgColor)); addText(c, cell.getName()); if (iTable.getResourceType()!=TimetableGridModel.sResourceTypeRoom) addText(c, cell.getRoomName()); if (iTable.getShowComments()) addText(c, cell.getShortComment()==null?"":cell.getShortComment()); if (iTable.getWeek()==-100 && cell.hasDays() && !cell.getDays().equals(iTable.getDefaultDatePatternName())) addText(c, cell.getDays()); iPdfTable.addCell(c); } } } } */ } if (iTable.isDispModePerWeek()) { flushTable(); } }
From source file:tk.diginspect.main.SoOFSignatories.java
public void createPDF() { doc = new Document(PageSize.A4); try {//w w w.j a v a2 s .c o m String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/RFO"; File dir = new File(path); if (!dir.exists()) { dir.mkdirs(); } String strFinalname, strFilename2, strFilenames; String filename = sp.getString("EstablishmentName", null); String strfilename = filename.replaceAll("\\W+", "-"); String inspector = sp.getString("FDRO1", null); String inspby = inspector.replaceAll("\\W+", "-"); File file = new File(dir, strfilename + "-" + strFile + "-" + inspby + ".pdf"); strFilename2 = strfilename + "-" + strFile + "-" + inspby; strFilenames = strFilename2 + ".pdf"; strFinalname = path + "/" + strFilenames; savePreferences("fileName", strFinalname); FileOutputStream fOut = new FileOutputStream(file); PdfWriter.getInstance(doc, fOut); doc.open(); FDALetterhead(); // General Info Table float[] table1columnWidths = { 1f, 1f, 1f, 1f }; PdfPTable table1 = new PdfPTable(table1columnWidths); table1.setWidthPercentage(110f); table1.setSpacingAfter(20f); insertCell(table1, "INSPECTION REPORT", Element.ALIGN_CENTER, 4, "#8EBAFF", 1, 0); insertCell(table1, "Name of Establishment", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("EstablishmentName", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Plant/Office Address", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PlantOfficeAddress", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Warehouse Address", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("WarehouseAddress", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Owner", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Owner", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Telephone Number", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("TelNumber", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Fax No", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("FaxNumber", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Classification", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); String Classification = sp.getString("MainClass", null) + ", " + sp.getString("SecClass", null) + ", " + sp.getString("ThirdClass", null) + ", " + sp.getString("FourthClass", ""); insertCell(table1, Classification, Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Product/s:", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Products", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Manner of Notification", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Notification", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Purpose of Inspection", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Inspection", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Registered Pharmacist / Authorized Representative / Person", Element.ALIGN_LEFT, 4, "#8EBAFF", 1, 0); insertCell(table1, "Name", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PharmacistName", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Reg. No. (PRC-ID)", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PrcID", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Date Issued", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PrcDateIssued", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Validity", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PrcValidity", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Position", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PharmacistPosition", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Person/s Interviewed", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("InterviewedName", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Position", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("InterviewedPosition", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "License to Operate", Element.ALIGN_LEFT, 4, "#8EBAFF", 1, 0); insertCell(table1, "Number", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("LTONumber", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Renewal", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("LTORenewalDate", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Validity", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("LTOValidity", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Payment of Appropriate Fee", Element.ALIGN_LEFT, 4, "#8EBAFF", 1, 0); insertCell(table1, "OR Number", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("ORNum", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Amount", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, "Php " + sp.getString("ORAmount", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Date of Payment", Element.ALIGN_LEFT, 0, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("ORDate", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "RSN", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 1); insertCell(table1, sp.getString("RSN", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 1); doc.add(table1); footer(); // 2nd Page doc.newPage(); FDALetterhead(); PdfPTable table2 = new PdfPTable(1); table2.setWidthPercentage(110f); table2.setSpacingAfter(20f); insertCell(table2, "Observation Findings:", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell1(table2, sp.getString("ObservationFindings", ""), 1, 1, 600f); doc.add(table2); footer(); // 3rd Page doc.newPage(); FDALetterhead(); PdfPTable table3 = new PdfPTable(1); table3.setWidthPercentage(110f); table3.setSpacingAfter(20f); insertCell(table3, "Directives:", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 1); nested(table3, 0.1f, 2f, R.string.directives1, sp.getBoolean("Directives1", false), Element.ALIGN_LEFT); nested(table3, 0.1f, 2f, R.string.directives2, sp.getBoolean("Directives2", false), Element.ALIGN_LEFT); nested(table3, 0.2f, 2f, R.string.directives3, sp.getBoolean("Directives3", false), Element.ALIGN_RIGHT); nested(table3, 0.2f, 2f, R.string.directives4, sp.getBoolean("Directives4", false), Element.ALIGN_RIGHT); nested(table3, 0.1f, 2f, R.string.directives5, sp.getBoolean("Directives5", false), Element.ALIGN_LEFT); nested(table3, 0.1f, 2f, R.string.directives6, sp.getBoolean("Directives6", false), Element.ALIGN_LEFT); nested(table3, 0.1f, 2f, R.string.directives7, sp.getBoolean("Directives7", false), Element.ALIGN_LEFT); String Directives8 = getResources().getString(R.string.directives8); PdfPCell cellDirectives8 = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, Directives8)); cellDirectives8.setPaddingLeft(50); cellDirectives8.setPaddingTop(5); cellDirectives8.setPaddingBottom(5); cellDirectives8.setPaddingRight(5); cellDirectives8.setBorderWidthTop(0); cellDirectives8.setBorderWidthBottom(0); table3.addCell(cellDirectives8); String Directives = sp.getString("Directives8", null); boolean Directives9 = false, Directives10 = false; if (Directives.equals(R.string.directives9)) { Directives9 = true; Directives10 = false; } else if (Directives.equals(R.string.directives10)) { Directives9 = false; Directives10 = true; } else { Directives9 = false; Directives10 = false; } nested(table3, 0.3f, 2f, R.string.directives9, Directives9, Element.ALIGN_RIGHT); nested(table3, 0.3f, 2f, R.string.directives10, Directives10, Element.ALIGN_RIGHT); insertCell(table3, "Inspected By:", Element.ALIGN_CENTER, 1, "#8EBAFF", 1, 0); PdfPTable signature1 = new PdfPTable(2); sig(signature1, "FDRO1"); sig(signature1, "FDRO2"); insertCell(signature1, sp.getString("FDRO1", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, sp.getString("FDRO2", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, "Food-Drug Regulation Officer", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature1, "Food-Drug Regulation Officer", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature1, "Date: " + dateStarted, Element.ALIGN_LEFT, 1, "#FFFFFF", 1, 0); insertCell(signature1, "Time: " + timeS, Element.ALIGN_LEFT, 1, "#FFFFFF", 1, 0); sig(signature1, "EstRep1"); sig(signature1, "EstRep2"); insertCell(signature1, sp.getString("EstRep1", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, sp.getString("EstRep2", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, "Establishments Representative", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); insertCell(signature1, "Establishments Representative", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); PdfPCell nesthousing1 = new PdfPCell(signature1); table3.addCell(nesthousing1); doc.add(table3); footer(); // 4th Page doc.newPage(); FDALetterhead(); PdfPTable table4 = new PdfPTable(1); table4.setWidthPercentage(110f); table4.setSpacingAfter(20f); insertCell(table4, "(FDA USE ONLY)", Element.ALIGN_CENTER, 1, "#8EBAFF", 1, 1); insertCell(table4, "Compliance Made by the Company", Element.ALIGN_LEFT, 1, "#FFFFFF", 0, 0); nested(table4, 0.1f, 2f, R.string.CAPA, false, Element.ALIGN_LEFT); nested(table4, 0.2f, 2f, R.string.Accepted, false, Element.ALIGN_RIGHT); nested(table4, 0.2f, 2f, R.string.NotAccepted, false, Element.ALIGN_RIGHT); insertCell(table4, "Recommendation (to Licensing) :", Element.ALIGN_LEFT, 1, "#FFFFFF", 0, 0); insertCell1(table4, "", 0, 0, 100f); PdfPTable signature2 = new PdfPTable(2); insertCell1(signature2, "", 0, 0, 50f); insertCell1(signature2, "", 0, 0, 50f); insertCell(signature2, "Print Name & Signature of FDRO/s", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature2, "Date", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature2, "Reviewed by:", Element.ALIGN_LEFT, 2, "#8EBAFF", 1, 1); insertCell1(signature2, "", 0, 0, 50f); insertCell1(signature2, "", 0, 0, 50f); insertCell(signature2, "Print Name & Signature of Team Leader/Supervisor", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); insertCell(signature2, "Date", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); PdfPCell nesthousing2 = new PdfPCell(signature2); table4.addCell(nesthousing2); doc.add(table4); footer(); } catch (DocumentException de) { Log.e("PDFCreator", "DocumentException:" + de); } catch (FileNotFoundException e) { Log.e("PDFCreator", "ioException:" + e); } finally { doc.close(); } }
From source file:tk.diginspect.main.SoOFSignatories.java
private void insertCell(PdfPTable table, String text, int align, int colspan, String color, float BorderWidthTop, float BorderWidthBottom) { PdfPCell cell = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, text)); cell.setHorizontalAlignment(align);/*from ww w. j a va 2 s. c o m*/ cell.setColspan(colspan); cell.setBackgroundColor(WebColors.getRGBColor(color)); cell.setPadding(5); cell.setBorderWidthTop(BorderWidthTop); cell.setBorderWidthBottom(BorderWidthBottom); table.addCell(cell); }
From source file:tk.diginspect.main.SoOFSignatories.java
private void insertCell1(PdfPTable table, String text, float borderWidthTop, float borderWidthBottom, float fixedHeight) { PdfPCell cell = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, text)); cell.setBackgroundColor(WebColors.getRGBColor("#FFFFFF")); cell.setPadding(5);/* w w w. j ava 2 s .c o m*/ cell.setBorderWidthTop(borderWidthTop); cell.setBorderWidthBottom(borderWidthBottom); cell.setFixedHeight(fixedHeight); table.addCell(cell); }
From source file:tk.diginspect.main.SoOFSignatories.java
private void nested(PdfPTable table, float column1, float column2, int directives, boolean checkmark, int align) { float[] nestedcolumnWidths = { column1, column2 }; PdfPTable nested = new PdfPTable(nestedcolumnWidths); if (checkmark == true) { Checked(nested, align, R.drawable.checked); } else if (checkmark == false) { Checked(nested, align, R.drawable.unchecked); }/*w w w. ja v a 2 s . c o m*/ String Directives = getResources().getString(directives); PdfPCell cell = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, Directives)); cell.setPadding(5); cell.setBorderWidth(0); nested.addCell(cell); PdfPCell nesthousing = new PdfPCell(nested); nesthousing.setBorderWidthTop(0); nesthousing.setBorderWidthBottom(0); table.addCell(nesthousing); }