List of usage examples for com.lowagie.text Rectangle NO_BORDER
int NO_BORDER
To view the source code for com.lowagie.text Rectangle NO_BORDER.
Click Source Link
From source file:org.areasy.common.doclet.document.Summary.java
License:Open Source License
/** * Creates the inner table for both columns. The left column * already contains the declaration text part. * * @param text The text (like "static final"..) *///from w w w . j a v a 2 s. c o m private static PdfPTable addDeclaration(String text, Phrase returnType) throws DocumentException { PdfPTable innerTable = new PdfPTable(2); innerTable.setWidthPercentage(100f); innerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); innerTable.setWidths(new int[] { 24, 76 }); Paragraph declarationParagraph = new Paragraph((float) 9.0); Chunk leftPart = new Chunk(text, Fonts.getFont(CODE_FONT, 9)); declarationParagraph.add(leftPart); if (returnType != null) { declarationParagraph.add(returnType); declarationParagraph.add(new Chunk(" ", Fonts.getFont(CODE_FONT, 9))); } PdfPCell cell = new CustomPdfPCell(Rectangle.RIGHT, declarationParagraph, 1, Color.gray); cell.setPaddingTop((float) 4.0); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); innerTable.addCell(cell); return innerTable; }
From source file:org.areasy.common.doclet.document.Summary.java
License:Open Source License
/** * Creates the two columns for the summary table and, if necessary, * fills in the "Deprecated" text. Otherwise, the given elements * are filled in./*from ww w.j a v a 2 s. c o m*/ * * @param objs The description elements. * @param isDeprecated If true, the whole class/method is deprecated. * @param deprecatedPhrase The phrase for the deprecated text. * @return The summary table columns. * @throws DocumentException If something failed. */ private static PdfPTable createColumnsAndDeprecated(Element[] objs, boolean isDeprecated, Phrase deprecatedPhrase) throws DocumentException { PdfPTable commentsTable = null; commentsTable = new PdfPTable(2); commentsTable.setWidths(new int[] { 5, 95 }); commentsTable.setWidthPercentage(100f); commentsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); commentsTable.addCell(new Phrase("")); Phrase descPhr = new Phrase(); CellNoBorderNoPadding cell = new CellNoBorderNoPadding(descPhr); commentsTable.addCell(cell); if (isDeprecated) { // if the method is deprecated... // do not print the comment text... // just print the deprecated text descPhr.add(new Phrase(AbstractConfiguration.LB_DEPRECATED_TAG, Fonts.getFont(TEXT_FONT, BOLD, 10))); descPhr.add(deprecatedPhrase); } else if (objs.length != 0) { for (int i = 0; i < objs.length; i++) { if (objs[i] instanceof List) { cell.addElement(objs[i]); descPhr = new Phrase(""); cell.addElement(descPhr); } else { descPhr.add(objs[i]); } } } return commentsTable; }
From source file:org.areasy.common.doclet.document.tags.TagTABLE.java
License:Open Source License
private void createTable(int numcols) { table = new PdfPTable(numcols); String width = getAttribute("width"); if (width == null) table.setWidthPercentage(100);/* w w w . j a v a2 s. c om*/ else if (width.endsWith("%")) table.setWidthPercentage(HtmlTagUtility.parseFloat(width, 100f)); else table.setTotalWidth(HtmlTagUtility.parseFloat(width, 400f)); table.getDefaultCell().setPadding(HtmlTagUtility.parseFloat(getAttribute("cellpadding"), 2.0f)); table.getDefaultCell().setBackgroundColor(HtmlTagUtility.getColor(getAttribute("bgcolor"))); table.setHorizontalAlignment(HtmlTagUtility.getAlignment(getAttribute("align"), Element.ALIGN_CENTER)); /* Border doesn't have to have a value set */ if (getAttribute("border") != null) { table.getDefaultCell().setBorder(Rectangle.BOX); table.getDefaultCell().setBorderWidth(HtmlTagUtility.parseFloat(getAttribute("border"), 1.0f)); table.getDefaultCell().setBorderColor(HtmlTagUtility.getColor("gray")); } else { table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.getDefaultCell().setBorderWidth(0.0f); } //set width data for columns. setTableWidthsForCells(); }
From source file:org.displaytag.export.PdfView.java
License:Artistic License
/** * @see org.displaytag.export.BinaryExportView#doExport(OutputStream) *//* w w w . j ava 2 s . c o m*/ public void doExport(OutputStream out) throws JspException { try { // Initialize the table with the appropriate number of columns initTable(); // Initialize the Document and register it with PdfWriter listener and the OutputStream Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40); document.addCreationDate(); HeaderFooter footer = new HeaderFooter(new Phrase(TagConstants.EMPTY_STRING, smallFont), true); footer.setBorder(Rectangle.NO_BORDER); footer.setAlignment(Element.ALIGN_CENTER); PdfWriter.getInstance(document, out); // Fill the virtual PDF table with the necessary data generatePDFTable(); document.open(); document.setFooter(footer); document.add(this.tablePDF); document.close(); } catch (Exception e) { throw new PdfGenerationException(e); } }
From source file:org.displaytag.render.ItextTableWriter.java
License:Artistic License
/** * Initialize the main info holder table, like the appropriate number of columns. * @param model The table being represented as iText. * @see org.displaytag.render.TableWriterTemplate#writeTableOpener(org.displaytag.model.TableModel) *//*from ww w . j a v a 2 s . co m*/ protected void writeTableOpener(TableModel model) { // this.table.setDefaultVerticalAlignment(Element.ALIGN_TOP); //modify by mz this.table.setAlignment(Element.ALIGN_TOP); this.table.setCellsFitPage(true); this.table.setWidth(100); this.table.setPadding(2); this.table.setSpacing(0); this.table.setBorder(Rectangle.NO_BORDER); this.defaultFont = this.getTableFont(); }
From source file:org.egov.infra.web.displaytag.export.EGovPdfView.java
License:Open Source License
@Override public void doExport(final OutputStream out) throws JspException { try {/*from w w w. ja va2s .co m*/ // Initialize the table with the appropriate number of columns initTable(); // Initialize the Document and register it with PdfWriter listener and the OutputStream final Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40); document.addCreationDate(); final HeaderFooter footer = new HeaderFooter(new Phrase(TagConstants.TAGNAME_CAPTION, this.smallFont), true); footer.setBorder(Rectangle.NO_BORDER); footer.setAlignment(Element.ALIGN_CENTER); // PdfWriter.getInstance(document, out); PdfWriter.getInstance(document, out).setPageEvent(new PageNumber()); // Fill the virtual PDF table with the necessary data generatePDFTable(); document.open(); // Table table = new Table(this.model.getNumberOfColumns()); // ItextTableWriter writer = new ItextTableWriter(tablePDF, document); // writer.writeTable(this.model, "-1"); // document.setFooter(footer); // document.setHeader(footer); document.add(this.tableCaption); document.add(this.tablePDF); document.close(); } catch (final Exception e) { throw new PdfGenerationException(e); } }
From source file:org.jsondoc.springmvc.pdf.PdfExportView.java
License:Open Source License
public File getPdfFile(String filename) { try {//from w w w .ja va2s .com File file = new File(filename + "-v" + jsonDoc.getVersion() + FILE_EXTENSION); FileOutputStream fileout = new FileOutputStream(file); Document document = new Document(); PdfWriter.getInstance(document, fileout); // Header HeaderFooter header = new HeaderFooter(new Phrase("Copyright " + Calendar.getInstance().get(Calendar.YEAR) + " Paybay Networks - All rights reserved"), false); header.setBorder(Rectangle.NO_BORDER); header.setAlignment(Element.ALIGN_LEFT); document.setHeader(header); // Footer HeaderFooter footer = new HeaderFooter(new Phrase("Page "), true); footer.setBorder(Rectangle.NO_BORDER); footer.setAlignment(Element.ALIGN_CENTER); document.setFooter(footer); document.open(); //init documentation apiDocs = buildApiDocList(); apiMethodDocs = buildApiMethodDocList(apiDocs); Phrase baseUrl = new Phrase("Base url: " + jsonDoc.getBasePath()); document.add(baseUrl); document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); int pos = 1; for (ApiMethodDoc apiMethodDoc : apiMethodDocs) { Phrase phrase = new Phrase(/*"Description: " + */apiMethodDoc.getDescription()); document.add(phrase); document.add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(2); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.setWidthPercentage(100); table.setWidths(new int[] { 50, 200 }); // HEADER CELL START TABLE table.addCell(ITextUtils.getHeaderCell("URL")); table.addCell(ITextUtils.getHeaderCell("<baseUrl> " + apiMethodDoc.getPath())); table.completeRow(); // FIRST CELL table.addCell(ITextUtils.getCell("Http Method", 0)); table.addCell(ITextUtils.getCell(apiMethodDoc.getVerb().name(), pos)); pos++; table.completeRow(); // PRODUCES if (!apiMethodDoc.getProduces().isEmpty()) { table.addCell(ITextUtils.getCell("Produces", 0)); table.addCell(ITextUtils.getCell(buildApiMethodProduces(apiMethodDoc), pos)); pos++; table.completeRow(); } // CONSUMES if (!apiMethodDoc.getConsumes().isEmpty()) { table.addCell(ITextUtils.getCell("Consumes", 0)); table.addCell(ITextUtils.getCell(buildApiMethodConsumes(apiMethodDoc), pos)); pos++; table.completeRow(); } // HEADERS if (!apiMethodDoc.getHeaders().isEmpty()) { table.addCell(ITextUtils.getCell("Request headers", 0)); PdfPTable pathParamsTable = new PdfPTable(3); pathParamsTable.setWidths(new int[] { 30, 20, 40 }); pathParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); pathParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiHeaderDoc apiHeaderDoc : apiMethodDoc.getHeaders()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiHeaderDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); StringBuilder builder = new StringBuilder(); for (String value : apiHeaderDoc.getAllowedvalues()) builder.append(value).append(", "); paramCell.setPhrase(new Phrase("Allowed values: " + builder.toString())); paramCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase(apiHeaderDoc.getDescription())); pathParamsTable.addCell(paramCell); pathParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(pathParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // PATH PARAMS if (!apiMethodDoc.getPathparameters().isEmpty()) { table.addCell(ITextUtils.getCell("Path params", 0)); PdfPTable pathParamsTable = new PdfPTable(3); pathParamsTable.setWidths(new int[] { 30, 15, 40 }); pathParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); pathParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiParamDoc apiParamDoc : apiMethodDoc.getPathparameters()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiParamDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); paramCell.setPhrase(new Phrase(apiParamDoc.getJsondocType().getOneLineText())); paramCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase(apiParamDoc.getDescription())); pathParamsTable.addCell(paramCell); pathParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(pathParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // QUERY PARAMS if (!apiMethodDoc.getQueryparameters().isEmpty()) { table.addCell(ITextUtils.getCell("Query params", 0)); PdfPTable queryParamsTable = new PdfPTable(3); queryParamsTable.setWidths(new int[] { 30, 15, 40 }); queryParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); queryParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiParamDoc apiParamDoc : apiMethodDoc.getQueryparameters()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiParamDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); queryParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); paramCell.setPhrase(new Phrase(apiParamDoc.getJsondocType().getOneLineText())); paramCell.setBorder(Rectangle.NO_BORDER); queryParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase( apiParamDoc.getDescription() + ", mandatory: " + apiParamDoc.getRequired())); queryParamsTable.addCell(paramCell); queryParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(queryParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // BODY OBJECT if (null != apiMethodDoc.getBodyobject()) { table.addCell(ITextUtils.getCell("Body object:", 0)); String jsonObject = buildJsonFromTemplate(apiMethodDoc.getBodyobject().getJsondocTemplate()); table.addCell(ITextUtils.getCell(jsonObject, pos)); pos++; table.completeRow(); } // RESPONSE OBJECT table.addCell(ITextUtils.getCell("Json response:", 0)); table.addCell( ITextUtils.getCell(apiMethodDoc.getResponse().getJsondocType().getOneLineText(), pos)); pos++; table.completeRow(); // RESPONSE STATUS CODE table.addCell(ITextUtils.getCell("Status code:", 0)); table.addCell(ITextUtils.getCell(apiMethodDoc.getResponsestatuscode(), pos)); pos++; table.completeRow(); table.setSpacingAfter(10f); table.setSpacingBefore(5f); document.add(table); } document.close(); return file; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } return null; }
From source file:org.kuali.kfs.gl.report.TransactionReport.java
License:Open Source License
/** * Appends the scrubber totals/statistics and error report to the given (iText) document object. * /*ww w .ja v a 2s. com*/ * @param document the PDF document * @param headerFont font for header * @param textFont font for report text * @param errorSortedList list of error'd transactions * @param reportErrors map containing transactions and the errors associated with each transaction * @param reportSummary list of summary objects * @param runDate date report was run * @throws DocumentException */ public void appendReport(Document document, Font headerFont, Font textFont, List<Transaction> errorSortedList, Map<Transaction, List<Message>> reportErrors, List<Summary> reportSummary, Date runDate) throws DocumentException { // Sort what we get Collections.sort(reportSummary); float[] summaryWidths = { 80, 20 }; PdfPTable summary = new PdfPTable(summaryWidths); summary.setWidthPercentage(40); PdfPCell cell = new PdfPCell(new Phrase("S T A T I S T I C S", headerFont)); cell.setColspan(2); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); summary.addCell(cell); for (Iterator iter = reportSummary.iterator(); iter.hasNext();) { Summary s = (Summary) iter.next(); cell = new PdfPCell(new Phrase(s.getDescription(), textFont)); cell.setBorder(Rectangle.NO_BORDER); summary.addCell(cell); if ("".equals(s.getDescription())) { cell = new PdfPCell(new Phrase("", textFont)); cell.setBorder(Rectangle.NO_BORDER); summary.addCell(cell); } else { DecimalFormat nf = new DecimalFormat("###,###,###,##0"); cell = new PdfPCell(new Phrase(nf.format(s.getCount()), textFont)); cell.setBorder(Rectangle.NO_BORDER); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); summary.addCell(cell); } } cell = new PdfPCell(new Phrase("")); cell.setColspan(2); cell.setBorder(Rectangle.NO_BORDER); summary.addCell(cell); document.add(summary); if (reportErrors != null && reportErrors.size() > 0) { float[] warningWidths = { 4, 3, 6, 5, 5, 4, 5, 5, 4, 5, 5, 9, 4, 36 }; PdfPTable warnings = new PdfPTable(warningWidths); warnings.setHeaderRows(2); warnings.setWidthPercentage(100); cell = new PdfPCell(new Phrase("W A R N I N G S", headerFont)); cell.setColspan(14); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); warnings.addCell(cell); // Add headers cell = new PdfPCell(new Phrase("Year", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("COA", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Account", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Sacct", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Obj", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("SObj", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("BalTyp", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("ObjTyp", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Prd", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("DocType", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Origin", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("DocNbr", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Seq", headerFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase("Warning", headerFont)); warnings.addCell(cell); for (Iterator errorIter = errorSortedList.iterator(); errorIter.hasNext();) { Transaction tran = (Transaction) errorIter.next(); boolean first = true; List errors = (List) reportErrors.get(tran); for (Iterator listIter = errors.iterator(); listIter.hasNext();) { String msg = null; Object m = listIter.next(); if (m instanceof Message) { Message mm = (Message) m; msg = mm.getMessage(); } else { if (m == null) { msg = ""; } else { msg = m.toString(); } } if (first) { first = false; if (tran.getUniversityFiscalYear() == null) { cell = new PdfPCell(new Phrase("NULL", textFont)); } else { cell = new PdfPCell(new Phrase(tran.getUniversityFiscalYear().toString(), textFont)); } warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getChartOfAccountsCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getAccountNumber(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getSubAccountNumber(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialObjectCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialSubObjectCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialBalanceTypeCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialObjectTypeCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getUniversityFiscalPeriodCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialDocumentTypeCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getFinancialSystemOriginationCode(), textFont)); warnings.addCell(cell); cell = new PdfPCell(new Phrase(tran.getDocumentNumber(), textFont)); warnings.addCell(cell); if (tran.getTransactionLedgerEntrySequenceNumber() == null) { cell = new PdfPCell(new Phrase("NULL", textFont)); } else { cell = new PdfPCell(new Phrase( tran.getTransactionLedgerEntrySequenceNumber().toString(), textFont)); } warnings.addCell(cell); } else { cell = new PdfPCell(new Phrase("", textFont)); cell.setColspan(13); warnings.addCell(cell); } cell = new PdfPCell(new Phrase(msg, textFont)); warnings.addCell(cell); } } document.add(warnings); } }
From source file:org.kuali.kfs.module.cam.report.DepreciationReport.java
License:Open Source License
/** * This method adds the log lines into the report * //w ww. ja v a 2 s .c om * @param reportLog */ private void generateReportLogBody(List<String[]> reportLog) { try { Font font = FontFactory.getFont(FontFactory.HELVETICA, 9, Font.NORMAL); int columnwidths[]; columnwidths = new int[] { 40, 15 }; Table aTable = new Table(2, linesPerPage); int rowsWritten = 0; for (String[] columns : reportLog) { if (pageNumber == 0 || line >= linesPerPage) { if (pageNumber > 0) { this.document.add(aTable); } int elementsLeft = reportLog.size() - rowsWritten; int rowsNeeded = (elementsLeft >= linesPerPage ? linesPerPage : elementsLeft); this.document.newPage(); this.generateColumnHeaders(); aTable = new Table(2, rowsNeeded); // 12 columns, 11 rows. aTable.setAutoFillEmptyCells(true); aTable.setPadding(3); aTable.setWidths(columnwidths); aTable.setWidth(100); aTable.setBorder(Rectangle.NO_BORDER); line = 0; pageNumber++; } rowsWritten++; Cell cell; cell = new Cell(new Phrase(columns[0], font)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); aTable.addCell(cell); cell = new Cell(new Phrase(columns[1], font)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); aTable.addCell(cell); line++; } this.document.add(aTable); } catch (DocumentException de) { throw new RuntimeException( "DepreciationReport.generateReportLogBody(List<String[]> reportLog) - error: " + de.getMessage()); } }
From source file:org.kuali.kfs.module.endow.report.util.EndowmentReportPrintBase.java
License:Educational Community License
/** * Generates the report header sheet//from w ww . ja v a 2 s . c o m * * @param reportRequestHeaderDataHolder * @param document * @return */ public boolean printReportHeaderPage(EndowmentReportHeaderDataHolder reportRequestHeaderDataHolder, Document document, String listKemidsInHeader) { try { // report header Phrase header = new Paragraph(new Date().toString()); Paragraph title = new Paragraph(reportRequestHeaderDataHolder.getInstitutionName()); title.setAlignment(Element.ALIGN_CENTER); title.add("\nReport Request Header Sheet\n\n"); document.add(title); PdfPTable requestTable = new PdfPTable(2); requestTable.setWidthPercentage(REQUEST_INFO_TABLE_WIDTH); int[] requestWidths = { 20, 80 }; requestTable.setWidths(requestWidths); requestTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); Paragraph reportRequested = new Paragraph(reportRequestHeaderDataHolder.getReportRequested(), headerSheetRegularFont); Paragraph dateRequested = new Paragraph(new Date().toString(), headerSheetRegularFont); Paragraph requestedBy = new Paragraph(reportRequestHeaderDataHolder.getRequestedBy(), headerSheetRegularFont); Paragraph endowmentOption = new Paragraph(reportRequestHeaderDataHolder.getEndowmentOption(), headerSheetRegularFont); Paragraph reportOption = new Paragraph(reportRequestHeaderDataHolder.getReportOption(), headerSheetRegularFont); requestTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Report Requested:", Element.ALIGN_RIGHT)); requestTable.addCell(reportRequested); requestTable .addCell(createCellWithDefaultFontAndWithoutBorderLine("Date Requested:", Element.ALIGN_RIGHT)); requestTable.addCell(dateRequested); requestTable .addCell(createCellWithDefaultFontAndWithoutBorderLine("Reqeusted by:", Element.ALIGN_RIGHT)); requestTable.addCell(requestedBy); requestTable.addCell(""); requestTable.addCell(""); requestTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Endowment Option:", Element.ALIGN_RIGHT)); requestTable.addCell(endowmentOption); requestTable .addCell(createCellWithDefaultFontAndWithoutBorderLine("Report Option:", Element.ALIGN_RIGHT)); requestTable.addCell(reportOption); document.add(requestTable); // Criteria Paragraph criteria = new Paragraph("\nCriteria:\n\n"); document.add(criteria); PdfPTable criteriaTable = new PdfPTable(2); criteriaTable.setWidthPercentage(CRITERIA_TABLE_WIDTH); int[] criteriaWidths = { 30, 50 }; criteriaTable.setWidths(criteriaWidths); criteriaTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); Paragraph benefittingCampus = new Paragraph(reportRequestHeaderDataHolder.getBenefittingCampus(), headerSheetRegularFont); Paragraph benefittingChart = new Paragraph(reportRequestHeaderDataHolder.getBenefittingChart(), headerSheetRegularFont); Paragraph benefittingOrganization = new Paragraph( reportRequestHeaderDataHolder.getBenefittingOrganization(), headerSheetRegularFont); Paragraph kemidTypeCode = new Paragraph(reportRequestHeaderDataHolder.getKemidTypeCode(), headerSheetRegularFont); Paragraph kemidPurposeCode = new Paragraph(reportRequestHeaderDataHolder.getKemidPurposeCode(), headerSheetRegularFont); Paragraph combinationGroupCode = new Paragraph(reportRequestHeaderDataHolder.getCombineGroupCode(), headerSheetRegularFont); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Benefitting Campus:", Element.ALIGN_RIGHT)); criteriaTable.addCell(benefittingCampus); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Benefitting Chart:", Element.ALIGN_RIGHT)); criteriaTable.addCell(benefittingChart); criteriaTable.addCell(createCellWithDefaultFontAndWithoutBorderLine("Benefitting Organization:", Element.ALIGN_RIGHT)); criteriaTable.addCell(benefittingOrganization); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("KEMID Type Code:", Element.ALIGN_RIGHT)); criteriaTable.addCell(kemidTypeCode); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("KEMID Purpose Code:", Element.ALIGN_RIGHT)); criteriaTable.addCell(kemidPurposeCode); criteriaTable.addCell( createCellWithDefaultFontAndWithoutBorderLine("Combine Group Code:", Element.ALIGN_RIGHT)); criteriaTable.addCell(combinationGroupCode); document.add(criteriaTable); // kemids with multiple benefitting organization Paragraph kemidWithMultipleBenefittingOrganization = new Paragraph( "\nKEMIDs with Multiple Benefitting Organizations:\n\n"); document.add(kemidWithMultipleBenefittingOrganization); List<KemidsWithMultipleBenefittingOrganizationsDataHolder> kemidsWithMultipleBenefittingOrganizationsDataHolder = reportRequestHeaderDataHolder .getKemidsWithMultipleBenefittingOrganizationsDataHolders(); if (kemidsWithMultipleBenefittingOrganizationsDataHolder != null && !kemidsWithMultipleBenefittingOrganizationsDataHolder.isEmpty()) { PdfPTable kemidWithMultipleBenefittingOrganizationTable = new PdfPTable(5); kemidWithMultipleBenefittingOrganizationTable.setWidthPercentage(MULTIPLE_KEMID_TABLE_WIDTH); kemidWithMultipleBenefittingOrganizationTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); Paragraph kemid = new Paragraph("KEMID", titleFont); Paragraph campus = new Paragraph("Campus", titleFont); Paragraph chart = new Paragraph("Chart", titleFont); Paragraph organization = new Paragraph("Organziation", titleFont); Paragraph percent = new Paragraph("Percent", titleFont); kemidWithMultipleBenefittingOrganizationTable.addCell(kemid); kemidWithMultipleBenefittingOrganizationTable.addCell(campus); kemidWithMultipleBenefittingOrganizationTable.addCell(chart); kemidWithMultipleBenefittingOrganizationTable.addCell(organization); kemidWithMultipleBenefittingOrganizationTable.addCell(percent); for (KemidsWithMultipleBenefittingOrganizationsDataHolder kmbo : kemidsWithMultipleBenefittingOrganizationsDataHolder) { kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getKemid(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getCampus(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getChart(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getOrganization(), headerSheetRegularFont)); kemidWithMultipleBenefittingOrganizationTable .addCell(new Paragraph(kmbo.getPercent().toString(), headerSheetRegularFont)); } document.add(kemidWithMultipleBenefittingOrganizationTable); } else { Paragraph noneExistMessage = new Paragraph("NONE EXIST\n\n", headerSheetRegularFont); document.add(noneExistMessage); } // kemids selected if ("Y".equalsIgnoreCase(listKemidsInHeader)) { List<String> kemidsSelected = reportRequestHeaderDataHolder.getKemidsSelected(); int totalKemidsSelected = reportRequestHeaderDataHolder.getKemidsSelected().size(); Paragraph kemidsSelectedTitle = new Paragraph("\nKEMIDs Selected: " + totalKemidsSelected + "\n\n"); document.add(kemidsSelectedTitle); PdfPTable kemidsTable = new PdfPTable(KEMIDS_SELECTED_COLUMN_NUM); kemidsTable.setWidthPercentage(KEMID_SELECTED_TABLE_WIDTH); kemidsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (int i = 0; i < totalKemidsSelected; i++) { kemidsTable.addCell(new Paragraph(kemidsSelected.get(i), headerSheetRegularFont)); } // to fill out the rest of the empty cells. Otherwise, the row won't be displayed if (totalKemidsSelected % KEMIDS_SELECTED_COLUMN_NUM != 0) { for (int i = 0; i < (KEMIDS_SELECTED_COLUMN_NUM - totalKemidsSelected % KEMIDS_SELECTED_COLUMN_NUM); i++) { kemidsTable.addCell(""); } } document.add(kemidsTable); } } catch (Exception e) { return false; } return true; }