List of usage examples for com.lowagie.text Element ALIGN_LEFT
int ALIGN_LEFT
To view the source code for com.lowagie.text Element ALIGN_LEFT.
Click Source Link
From source file:org.kuali.kfs.module.ar.batch.service.impl.CustomerLoadServiceImpl.java
License:Open Source License
protected void writeCustomerSectionResult(Document pdfDoc, String resultLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); paragraph.add(new Chunk(resultLine, font)); // blank line paragraph.add(new Chunk("", font)); try {/* ww w .j av a 2 s. com*/ pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
From source file:org.kuali.kfs.module.ar.batch.service.impl.CustomerLoadServiceImpl.java
License:Open Source License
protected void writeMessageEntryLines(Document pdfDoc, List<String[]> messageLines) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL); Paragraph paragraph;//w w w . j a v a 2 s .com String messageEntry; for (String[] messageLine : messageLines) { paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); messageEntry = StringUtils.rightPad(messageLine[0], (12 - messageLine[0].length()), " ") + " - " + messageLine[1].toUpperCase(); paragraph.add(new Chunk(messageEntry, font)); // blank line paragraph.add(new Chunk("", font)); try { pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } } }
From source file:org.kuali.kfs.module.ar.report.service.impl.ContractsGrantsInvoiceReportServiceImpl.java
License:Open Source License
/** * Generates the pdf file for printing the envelopes. * * @param list/*from w w w . java2 s . c o m*/ * @param outputStream * @throws DocumentException * @throws IOException */ protected void generateCombinedPdfForEnvelopes(Collection<ContractsGrantsInvoiceDocument> list, OutputStream outputStream) throws DocumentException, IOException { Document document = new Document( new Rectangle(ArConstants.InvoiceEnvelopePdf.LENGTH, ArConstants.InvoiceEnvelopePdf.WIDTH)); PdfWriter.getInstance(document, outputStream); boolean pageAdded = false; for (ContractsGrantsInvoiceDocument invoice : list) { // add a document for (InvoiceAddressDetail invoiceAddressDetail : invoice.getInvoiceAddressDetails()) { if (ArConstants.InvoiceTransmissionMethod.MAIL .equals(invoiceAddressDetail.getInvoiceTransmissionMethodCode())) { CustomerAddress address = invoiceAddressDetail.getCustomerAddress(); Integer numberOfEnvelopesToPrint = address.getCustomerEnvelopesToPrintQuantity(); if (ObjectUtils.isNull(numberOfEnvelopesToPrint)) { numberOfEnvelopesToPrint = 1; } for (int i = 0; i < numberOfEnvelopesToPrint; i++) { // if a page has not already been added then open the document. if (!pageAdded) { document.open(); } pageAdded = true; document.newPage(); // adding the sent From address Organization org = invoice.getInvoiceGeneralDetail().getAward() .getPrimaryAwardOrganization().getOrganization(); Paragraph sentBy = generateAddressParagraph(org.getOrganizationName(), org.getOrganizationLine1Address(), org.getOrganizationLine2Address(), org.getOrganizationCityName(), org.getOrganizationStateCode(), org.getOrganizationZipCode(), ArConstants.PdfReportFonts.ENVELOPE_SMALL_FONT); sentBy.setIndentationLeft(ArConstants.InvoiceEnvelopePdf.INDENTATION_LEFT); sentBy.setAlignment(Element.ALIGN_LEFT); // adding the send To address String string; Paragraph sendTo = generateAddressParagraph(address.getCustomerAddressName(), address.getCustomerLine1StreetAddress(), address.getCustomerLine2StreetAddress(), address.getCustomerCityName(), address.getCustomerStateCode(), address.getCustomerZipCode(), ArConstants.PdfReportFonts.ENVELOPE_TITLE_FONT); sendTo.setAlignment(Element.ALIGN_CENTER); sendTo.add(new Paragraph(KFSConstants.BLANK_SPACE)); document.add(sentBy); document.add(sendTo); } } } } if (pageAdded) { document.close(); } }
From source file:org.kuali.kfs.module.cam.report.DepreciationReport.java
License:Open Source License
/** * This method adds the log lines into the report * //from w w w . j a 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 footer//from w ww . ja v a 2 s . com * * @param footerData * @param document */ public boolean printFooter(EndowmentReportFooterDataHolder footerData, Document document) { if (footerData == null) { return false; } try { document.add(new Phrase("\n")); PdfPTable table = new PdfPTable(2); table.setWidthPercentage(FULL_TABLE_WIDTH); int[] colWidths = { 40, 60 }; table.setWidths(colWidths); table.getDefaultCell().setPadding(2); // left column PdfPTable leftTable = new PdfPTable(2); leftTable.setWidths(colWidths); leftTable.setWidthPercentage(40); leftTable.addCell(createCell("Reference: ", footerTitleFont, Element.ALIGN_LEFT, false)); leftTable.addCell(createCell(footerData.getReference(), footerRegularFont, Element.ALIGN_LEFT, false)); leftTable.addCell(createCell("Date Established: ", footerTitleFont, Element.ALIGN_LEFT, false)); leftTable.addCell( createCell(footerData.getEstablishedDate(), footerRegularFont, Element.ALIGN_LEFT, false)); leftTable.addCell(createCell("KEMID Type: ", footerTitleFont, Element.ALIGN_LEFT, false)); leftTable.addCell(createCell(footerData.getKemidType(), footerRegularFont, Element.ALIGN_LEFT, false)); leftTable.addCell(createCell("KEMID Purpose: ", footerTitleFont, Element.ALIGN_LEFT, false)); leftTable.addCell( createCell(footerData.getKemidPurpose(), footerRegularFont, Element.ALIGN_LEFT, false)); leftTable.addCell(createCell("Report Run Date: ", footerTitleFont, Element.ALIGN_LEFT, false)); leftTable.addCell( createCell(footerData.getReportRunDate(), footerRegularFont, Element.ALIGN_LEFT, false)); table.addCell(leftTable); // right column PdfPTable rightTable = new PdfPTable(4); rightTable.setWidthPercentage(60); PdfPCell cellBenefitting = new PdfPCell(new Paragraph("BENEFITTING\n", titleFont)); cellBenefitting.setColspan(4); cellBenefitting.setBorderWidth(0); rightTable.addCell(cellBenefitting); rightTable.addCell(createCell("Campus", footerTitleFont, Element.ALIGN_LEFT, false)); rightTable.addCell(createCell("Chart", footerTitleFont, Element.ALIGN_LEFT, false)); rightTable.addCell(createCell("Organizaztion", footerTitleFont, Element.ALIGN_LEFT, false)); rightTable.addCell(createCell("Percent", footerTitleFont, Element.ALIGN_LEFT, false)); List<BenefittingForFooter> benefittingList = footerData.getBenefittingList(); if (benefittingList != null) { for (BenefittingForFooter benefitting : benefittingList) { rightTable.addCell(createCell(benefitting.getCampusName(), footerRegularFont, Element.ALIGN_LEFT, Element.ALIGN_TOP, false)); rightTable.addCell(createCell(benefitting.getChartName(), footerRegularFont, Element.ALIGN_LEFT, Element.ALIGN_TOP, false)); rightTable.addCell(createCell(benefitting.getOrganizationName(), footerRegularFont, Element.ALIGN_LEFT, Element.ALIGN_TOP, false)); rightTable.addCell(createCell(benefitting.getBenefittingPercent(), footerRegularFont, Element.ALIGN_LEFT, Element.ALIGN_TOP, false)); } } table.addCell(rightTable); document.add(table); } catch (Exception e) { return false; } return true; }
From source file:org.kuali.kfs.module.endow.report.util.TransactionSummaryReportPrint.java
License:Educational Community License
/** * Helper method to go through the contributions list and write the lines.. * @param table/*from w ww . ja va 2s .c o m*/ * @param cellFont * @param transactionSummaryReport */ protected void writeContributionsRecordsForDetailReportOption(PdfPTable table, Font cellFont, TransactionSummaryReportDataHolder transactionSummaryReport) { String amount; BigDecimal totalIncomeAmounts = BigDecimal.ZERO; BigDecimal totalPrincipalAmounts = BigDecimal.ZERO; //write Contributions header.... writeSubHeader(table, "Contibutions and Other Income", EndowConstants.EndowmentReport.DETAIL); //now write out the records.... List<ContributionsDataHolder> contributionsData = transactionSummaryReport .getReportGroupsForContributions(); if (contributionsData != null) { for (ContributionsDataHolder contribution : contributionsData) { table.addCell(createCell("\t\t\t\t\t\t\t".concat(contribution.getContributionsDescription()), cellFont, Element.ALIGN_LEFT, true)); totalIncomeAmounts = totalIncomeAmounts.add(contribution.getIncomeContributions()); amount = formatAmount(contribution.getIncomeContributions()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); totalPrincipalAmounts = totalPrincipalAmounts.add(contribution.getPrincipalContributions()); amount = formatAmount(contribution.getPrincipalContributions()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(contribution.getTotalContributions()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); } } //now write out the sub-total line....amount table.addCell("\t\t\t\t\t\t\t\tActivity Sub-Total"); amount = formatAmount(totalIncomeAmounts); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(totalPrincipalAmounts); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(totalIncomeAmounts.add(totalPrincipalAmounts)); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); }
From source file:org.kuali.kfs.module.endow.report.util.TransactionSummaryReportPrint.java
License:Educational Community License
/** * Helper method to go through the contributions list and write the lines..For summary report * @param table//from www. j av a 2s.c o m * @param cellFont * @param transactionSummaryReport */ protected void writeContributionsRecordsForSummaryReportOption(PdfPTable table, Font cellFont, TransactionSummaryReportDataHolder transactionSummaryReport) { String amount; BigDecimal totalIncomeAmounts = BigDecimal.ZERO; BigDecimal totalPrincipalAmounts = BigDecimal.ZERO; //write Contributions header.... writeSubHeader(table, "Contibutions and Other Income", EndowConstants.EndowmentReport.TOTAL); //now write out the records.... List<ContributionsDataHolder> contributionsData = transactionSummaryReport .getReportGroupsForContributions(); if (contributionsData != null) { for (ContributionsDataHolder contribution : contributionsData) { table.addCell(createCell("\t\t\t\t\t\t\t".concat(contribution.getContributionsDescription()), cellFont, Element.ALIGN_LEFT, true)); totalIncomeAmounts = totalIncomeAmounts.add(contribution.getIncomeContributions()); totalPrincipalAmounts = totalPrincipalAmounts.add(contribution.getPrincipalContributions()); amount = formatAmount(contribution.getTotalContributions()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); } } //now write out the sub-total line....amount table.addCell("\t\t\t\t\t\t\t\tActivity Sub-Total"); amount = formatAmount(totalIncomeAmounts.add(totalPrincipalAmounts)); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); }
From source file:org.kuali.kfs.module.endow.report.util.TransactionSummaryReportPrint.java
License:Educational Community License
/** * Helper method to go through the expenses list and write the lines.. * @param table/*from w w w. j a v a 2 s .c o m*/ * @param cellFont * @param transactionSummaryReport */ protected void writeExpensesRecordsForDetailReportOption(PdfPTable table, Font cellFont, TransactionSummaryReportDataHolder transactionSummaryReport) { String amount; BigDecimal totalIncomeAmounts = BigDecimal.ZERO; BigDecimal totalPrincipalAmounts = BigDecimal.ZERO; //write Contributions header.... writeSubHeader(table, "Expenses", EndowConstants.EndowmentReport.DETAIL); //now write out the records.... List<ExpensesDataHolder> expensesData = transactionSummaryReport.getReportGroupsForExpenses(); if (expensesData != null) { for (ExpensesDataHolder expenses : expensesData) { table.addCell(createCell("\t\t\t\t\t\t\t".concat(expenses.getExpensesDescription()), cellFont, Element.ALIGN_LEFT, true)); totalIncomeAmounts = totalIncomeAmounts.add(expenses.getIncomeExpenses()); amount = formatAmount(expenses.getIncomeExpenses()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); totalPrincipalAmounts = totalPrincipalAmounts.add(expenses.getPrincipalExpenses()); amount = formatAmount(expenses.getPrincipalExpenses()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(expenses.getTotalExpenses()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); } } //now write out the sub-total line....amount table.addCell("\t\t\t\t\t\t\t\tActivity Sub-Total"); amount = formatAmount(totalIncomeAmounts); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(totalPrincipalAmounts); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(totalIncomeAmounts.add(totalPrincipalAmounts)); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); }
From source file:org.kuali.kfs.module.endow.report.util.TransactionSummaryReportPrint.java
License:Educational Community License
/** * Helper method to go through the expenses list and write the lines.. * @param table/*from w w w . java 2 s . c o m*/ * @param cellFont * @param transactionSummaryReport */ protected void writeExpensesRecordsForSummaryReportOption(PdfPTable table, Font cellFont, TransactionSummaryReportDataHolder transactionSummaryReport) { String amount; BigDecimal totalIncomeAmounts = BigDecimal.ZERO; BigDecimal totalPrincipalAmounts = BigDecimal.ZERO; //write Contributions header.... writeSubHeader(table, "Expenses", EndowConstants.EndowmentReport.TOTAL); //now write out the records.... List<ExpensesDataHolder> expensesData = transactionSummaryReport.getReportGroupsForExpenses(); if (expensesData != null) { for (ExpensesDataHolder expenses : expensesData) { table.addCell(createCell("\t\t\t\t\t\t\t".concat(expenses.getExpensesDescription()), cellFont, Element.ALIGN_LEFT, true)); totalIncomeAmounts = totalIncomeAmounts.add(expenses.getIncomeExpenses()); totalPrincipalAmounts = totalPrincipalAmounts.add(expenses.getPrincipalExpenses()); amount = formatAmount(expenses.getTotalExpenses()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); } } //now write out the sub-total line....amount table.addCell("\t\t\t\t\t\t\t\tActivity Sub-Total"); amount = formatAmount(totalIncomeAmounts.add(totalPrincipalAmounts)); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); }
From source file:org.kuali.kfs.module.endow.report.util.TransactionSummaryReportPrint.java
License:Educational Community License
/** * Helper method to go through the cash transfers list and write the lines.. * @param table/*from ww w . j a v a2 s . c o m*/ * @param cellFont * @param transactionSummaryReport */ protected void writeCashTransfersRecordsForDetailReportOption(PdfPTable table, Font cellFont, TransactionSummaryReportDataHolder transactionSummaryReport) { String amount; BigDecimal totalIncomeAmounts = BigDecimal.ZERO; BigDecimal totalPrincipalAmounts = BigDecimal.ZERO; //write Contributions header.... writeSubHeader(table, "Cash Transfers", EndowConstants.EndowmentReport.DETAIL); //now write out the records.... List<CashTransfersDataHolder> cashTransfersData = transactionSummaryReport .getReportGroupsForCashTransfers(); if (cashTransfersData != null) { for (CashTransfersDataHolder cashTransfer : cashTransfersData) { table.addCell(createCell("\t\t\t\t\t\t\t".concat(cashTransfer.getCashTransfersDescription()), cellFont, Element.ALIGN_LEFT, true)); totalIncomeAmounts = totalIncomeAmounts.add(cashTransfer.getIncomeCashTransfers()); amount = formatAmount(cashTransfer.getIncomeCashTransfers()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); totalPrincipalAmounts = totalPrincipalAmounts.add(cashTransfer.getPrincipalCashTransfers()); amount = formatAmount(cashTransfer.getPrincipalCashTransfers()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(cashTransfer.getTotalCashTransfers()); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); } } //now write out the sub-total line....amount table.addCell("\t\t\t\t\t\t\t\tActivity Sub-Total"); amount = formatAmount(totalIncomeAmounts); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(totalPrincipalAmounts); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); amount = formatAmount(totalIncomeAmounts.add(totalPrincipalAmounts)); table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true)); }