Example usage for com.lowagie.text Paragraph setAlignment

List of usage examples for com.lowagie.text Paragraph setAlignment

Introduction

In this page you can find the example usage for com.lowagie.text Paragraph setAlignment.

Prototype

public void setAlignment(String alignment) 

Source Link

Document

Sets the alignment of this paragraph.

Usage

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Prints report body for endowment detail
 * //w w  w. j  av  a2s  .c  om
 * @param endowmentAssetStatementReportDataHolders
 * @param document
 * @return
 */
public boolean printAssetStatementReportBodyForEndowmentTotal(
        List<AssetStatementReportDataHolder> endowmentAssetStatementReportDataHolders, Document document) {

    BigDecimal totalHistoryIncomeCash = BigDecimal.ZERO;
    BigDecimal totalHistoryPrincipalCash = BigDecimal.ZERO;
    TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForIncomeTotal = null;
    TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForPrincipalTotal = null;

    // get the cash totals
    for (AssetStatementReportDataHolder data : endowmentAssetStatementReportDataHolders) {
        totalHistoryIncomeCash = totalHistoryIncomeCash.add(data.getHistoryIncomeCash());
        totalHistoryPrincipalCash = totalHistoryPrincipalCash.add(data.getHistoryPrincipalCash());
    }

    // for income
    reportGroupsForIncomeTotal = createReportGroupsForTotal(endowmentAssetStatementReportDataHolders,
            IncomePrincipalIndicator.INCOME);

    // for principal
    reportGroupsForPrincipalTotal = createReportGroupsForTotal(endowmentAssetStatementReportDataHolders,
            IncomePrincipalIndicator.PRINCIPAL);

    // for each kemid
    try {
        Font cellFont = regularFont;

        // for the common info
        AssetStatementReportDataHolder reportData = endowmentAssetStatementReportDataHolders.get(0);

        document.newPage();

        // header
        StringBuffer title = new StringBuffer();
        title.append(reportData.getInstitution()).append("\n");
        title.append("STATEMENT OF ASSETS FOR PERIOD ENDING").append("\n");
        title.append(reportData.getMonthEndDate()).append("\n\n");
        Paragraph header = new Paragraph(title.toString());
        header.setAlignment(Element.ALIGN_CENTER);
        document.add(header);

        // report table
        float[] colsWidth = { 15f, 17f, 17f, 17f, 17f, 17f };
        PdfPTable table = new PdfPTable(colsWidth);
        table.setWidthPercentage(FULL_TABLE_WIDTH);
        table.getDefaultCell().setPadding(5);

        // column titles
        table.addCell("");
        table.addCell(createCell("UNITS HELD", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell("MARKET VALUE", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell("ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(
                createCell("FY REMAINDER ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell("NEXT FY ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));

        // 1. Expendable funds 

        PdfPCell cellExpendableFunds = new PdfPCell(new Paragraph("EXPENDABLE FUNDS", titleFont));
        cellExpendableFunds.setColspan(6);
        table.addCell(cellExpendableFunds);

        PdfPCell cellCashEquivalnets = new PdfPCell(new Paragraph("CASH AND EQUIVALENTS", titleFont));
        cellCashEquivalnets.setColspan(6);
        table.addCell(cellCashEquivalnets);

        // report groups for income
        printReportGroupForIncomeEndowmentTotal(reportGroupsForIncomeTotal, totalHistoryIncomeCash, document,
                table, cellFont);

        // 2. Endowed funds 

        PdfPCell cellEndowedFunds = new PdfPCell(new Paragraph("ENDOWED FUNDS", titleFont));
        cellEndowedFunds.setColspan(6);
        table.addCell(cellEndowedFunds);

        table.addCell(cellCashEquivalnets);

        // report groups for principal
        printReportGroupForPrincipalEndowmentTotal(reportGroupsForPrincipalTotal, totalHistoryPrincipalCash,
                document, table, cellFont);

        // 3. total (endowment + non-endowed)
        PdfPCell blank = new PdfPCell(new Paragraph("", cellFont));
        blank.setColspan(6);
        blank.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(blank);

        BigDecimal totalKemidMarketValue = BigDecimal.ZERO;
        BigDecimal totalKemidEstimatedAnnualIncome = BigDecimal.ZERO;
        BigDecimal totalKemidFYRemainderEstimatedAnnualIncome = BigDecimal.ZERO;
        BigDecimal totalKemidNextFYEstimayedAnnualIncome = BigDecimal.ZERO;
        for (AssetStatementReportDataHolder data : endowmentAssetStatementReportDataHolders) {
            totalKemidMarketValue = totalKemidMarketValue
                    .add(data.getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME)
                            .add(data.getTotalSumOfMarketValue(IncomePrincipalIndicator.PRINCIPAL)));
            totalKemidEstimatedAnnualIncome = totalKemidEstimatedAnnualIncome
                    .add(data.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME)
                            .add(data.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL)));
            totalKemidFYRemainderEstimatedAnnualIncome = totalKemidFYRemainderEstimatedAnnualIncome
                    .add(data.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME)
                            .add(data.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.PRINCIPAL)));
            totalKemidNextFYEstimayedAnnualIncome = totalKemidNextFYEstimayedAnnualIncome
                    .add(data.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME)
                            .add(data.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL)));
        }

        table.addCell(new Paragraph("TOTAL KEMID VALUE", titleFont));
        table.addCell("");
        table.addCell(getAmountCell(
                totalKemidMarketValue.add(totalHistoryIncomeCash).add(totalHistoryPrincipalCash), titleFont));
        table.addCell(getAmountCell(totalKemidEstimatedAnnualIncome, titleFont));
        table.addCell(getAmountCell(totalKemidFYRemainderEstimatedAnnualIncome, titleFont));
        table.addCell(getAmountCell(totalKemidNextFYEstimayedAnnualIncome, titleFont));

        document.add(table);

    } catch (Exception e) {
        LOG.error(e.getMessage());
        return false;
    }

    return true;

}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates the Asset Statement report for Non-Endowed total 
 * //w w w  .j  a  v a2 s.c o m
 * @param transactionStatementReports
 * @param document
 * @return
 */
public boolean printAssetStatementReportBodyForNonEndowedTotal(
        List<AssetStatementReportDataHolder> nonEndowedAssetStatementReportDataHolders, Document document) {

    BigDecimal totalHistoryIncomeCash = BigDecimal.ZERO;
    BigDecimal totalHistoryPrincipalCash = BigDecimal.ZERO;
    TreeMap<Integer, TreeMap<String, List<ReportGroupData>>> reportGroupsForTotal = null;

    // get the cash totals
    for (AssetStatementReportDataHolder data : nonEndowedAssetStatementReportDataHolders) {
        totalHistoryIncomeCash = totalHistoryIncomeCash.add(data.getHistoryIncomeCash());
        totalHistoryPrincipalCash = totalHistoryPrincipalCash.add(data.getHistoryPrincipalCash());
    }

    reportGroupsForTotal = createReportGroupsForTotal(nonEndowedAssetStatementReportDataHolders,
            IncomePrincipalIndicator.INCOME);

    // for each kemid
    try {
        Font cellFont = regularFont;

        // for the common info
        AssetStatementReportDataHolder reportData = nonEndowedAssetStatementReportDataHolders.get(0);

        document.newPage();

        // header
        StringBuffer title = new StringBuffer();
        title.append(reportData.getInstitution()).append("\n");
        title.append("STATEMENT OF ASSETS FOR PERIOD ENDING").append("\n");
        title.append(reportData.getMonthEndDate()).append("\n\n");
        Paragraph header = new Paragraph(title.toString());
        header.setAlignment(Element.ALIGN_CENTER);
        document.add(header);

        // report table
        float[] colsWidth = { 15f, 17f, 17f, 17f, 17f, 17f };
        PdfPTable table = new PdfPTable(colsWidth);
        table.setWidthPercentage(FULL_TABLE_WIDTH);
        table.getDefaultCell().setPadding(5);

        // column titles
        table.addCell("");
        table.addCell(createCell("UNITS HELD", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell("MARKET VALUE", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell("ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(
                createCell("FY REMAINDER ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell("NEXT FY ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));

        PdfPCell cellCashEquivalnets = new PdfPCell(new Paragraph("CASH AND EQUIVALENTS", titleFont));
        cellCashEquivalnets.setColspan(6);
        table.addCell(cellCashEquivalnets);

        // report groups
        printReportGroupForNonEndowedTotal(reportGroupsForTotal, totalHistoryIncomeCash,
                totalHistoryPrincipalCash, document, table, cellFont);

        // total
        PdfPCell blank = new PdfPCell(new Paragraph("", cellFont));
        blank.setColspan(6);
        blank.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(blank);

        BigDecimal totalKemidMarketValue = BigDecimal.ZERO;
        BigDecimal totalKemidEstimatedAnnualIncome = BigDecimal.ZERO;
        BigDecimal totalKemidFYRemainderEstimatedAnnualIncome = BigDecimal.ZERO;
        BigDecimal totalKemidNextFYEstimayedAnnualIncome = BigDecimal.ZERO;
        for (AssetStatementReportDataHolder data : nonEndowedAssetStatementReportDataHolders) {
            totalKemidMarketValue = totalKemidMarketValue
                    .add(data.getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME));
            totalKemidEstimatedAnnualIncome = totalKemidEstimatedAnnualIncome
                    .add(data.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME));
            totalKemidFYRemainderEstimatedAnnualIncome = totalKemidFYRemainderEstimatedAnnualIncome
                    .add(totalKemidFYRemainderEstimatedAnnualIncome
                            .add(data.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME)));
            totalKemidNextFYEstimayedAnnualIncome = totalKemidNextFYEstimayedAnnualIncome
                    .add(data.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME));
        }

        table.addCell(new Paragraph("TOTAL KEMID VALUE", titleFont));
        table.addCell("");
        table.addCell(getAmountCell(
                totalKemidMarketValue.add(totalHistoryIncomeCash).add(totalHistoryPrincipalCash), titleFont));
        table.addCell(getAmountCell(totalKemidEstimatedAnnualIncome, titleFont));
        table.addCell(getAmountCell(totalKemidFYRemainderEstimatedAnnualIncome, titleFont));
        table.addCell(getAmountCell(totalKemidNextFYEstimayedAnnualIncome, titleFont));

        document.add(table);

    } catch (Exception e) {
        LOG.error(e.getMessage());
        return false;
    }

    return true;
}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates the Asset Statement report for Endowment detail  
 * /*from w  w  w.  j a  va 2  s  . c o m*/
 * @param transactionStatementReports
 * @param document
 * @return
 */
public boolean printAssetStatementReportBodyForEndowmentDetail(
        List<AssetStatementReportDataHolder> endowmentAssetStatementReportDataHolders, Document document) {

    // for each kemid
    try {
        Font cellFont = regularFont;
        for (AssetStatementReportDataHolder reportData : endowmentAssetStatementReportDataHolders) {

            document.newPage();

            // header
            StringBuffer title = new StringBuffer();
            title.append(reportData.getInstitution()).append("\n");
            title.append("STATEMENT OF ASSETS FOR PERIOD ENDING").append("\n");
            title.append(reportData.getMonthEndDate()).append("\n");
            title.append(reportData.getKemid()).append("     ").append(reportData.getKemidLongTitle())
                    .append("\n\n");
            Paragraph header = new Paragraph(title.toString());
            header.setAlignment(Element.ALIGN_CENTER);
            document.add(header);

            // report table
            float[] colsWidth = { 15f, 17f, 17f, 17f, 17f, 17f };
            PdfPTable table = new PdfPTable(colsWidth);
            table.setWidthPercentage(FULL_TABLE_WIDTH);
            table.getDefaultCell().setPadding(5);

            // column titles
            table.addCell("");
            table.addCell(createCell("UNITS HELD", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("MARKET VALUE", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(
                    createCell("FY REMAINDER ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("NEXT FY ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));

            // 1. Expendable funds 

            PdfPCell cellExpendableFunds = new PdfPCell(new Paragraph("EXPENDABLE FUNDS", titleFont));
            cellExpendableFunds.setColspan(6);
            //cellExpendableFunds.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(cellExpendableFunds);

            PdfPCell cellCashEquivalnets = new PdfPCell(new Paragraph("CASH AND EQUIVALENTS", cellFont));
            cellCashEquivalnets.setColspan(6);
            table.addCell(cellCashEquivalnets);

            // report groups 
            printReportGroupForIncomeEndowmentDetail(reportData, document, table, cellFont);

            // 2. Endowed funds 

            PdfPCell cellEndowedFunds = new PdfPCell(new Paragraph("ENDOWED FUNDS", titleFont));
            cellEndowedFunds.setColspan(6);
            //cellEndowedFunds.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(cellEndowedFunds);

            table.addCell(cellCashEquivalnets);

            printReportGroupForPrincipalEndowmentDetail(reportData, document, table, cellFont);

            // 3. total (endowment + non-endowed)
            PdfPCell blank = new PdfPCell(new Paragraph("", cellFont));
            blank.setColspan(6);
            blank.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(blank);

            BigDecimal totalKemidMarketValue = reportData
                    .getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getHistoryIncomeCash())
                    .add(reportData.getTotalSumOfMarketValue(IncomePrincipalIndicator.PRINCIPAL)
                            .add(reportData.getHistoryPrincipalCash()));
            BigDecimal totalKemidEstimatedAnnualIncome = reportData
                    .getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL));
            BigDecimal totalKemidFYRemainderEstimatedAnnualIncome = reportData
                    .getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.PRINCIPAL));
            BigDecimal totalKemidNextFYEstimayedAnnualIncome = reportData
                    .getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL));

            table.addCell(new Paragraph("TOTAL KEMID VALUE", titleFont));
            table.addCell("");
            table.addCell(getAmountCell(totalKemidMarketValue, titleFont));
            table.addCell(getAmountCell(totalKemidEstimatedAnnualIncome, titleFont));
            table.addCell(getAmountCell(totalKemidFYRemainderEstimatedAnnualIncome, titleFont));
            table.addCell(getAmountCell(totalKemidNextFYEstimayedAnnualIncome, titleFont));

            document.add(table);

            // footer
            printFooter(reportData.getFooter(), document);
        }
    } catch (Exception e) {
        LOG.error(e.getMessage());
        return false;
    }

    return true;
}

From source file:org.kuali.kfs.module.endow.report.util.AssetStatementReportPrint.java

License:Educational Community License

/**
 * Generates the Asset Statement report for Non-Endowed    
 * /*from  w  w  w .j a v  a  2  s  . c om*/
 * @param transactionStatementReports
 * @param document
 * @return
 */
public boolean printAssetStatementReportBodyForNonEndowedDetail(
        List<AssetStatementReportDataHolder> nonEndowedAssetStatementReportDataHolders, Document document) {

    // for each kemid
    try {
        Font cellFont = regularFont;
        for (AssetStatementReportDataHolder reportData : nonEndowedAssetStatementReportDataHolders) {

            document.newPage();

            // header
            StringBuffer title = new StringBuffer();
            title.append(reportData.getInstitution()).append("\n");
            title.append("STATEMENT OF ASSETS FOR PERIOD ENDING").append("\n");
            title.append(reportData.getMonthEndDate()).append("\n");
            title.append(reportData.getKemid()).append("     ").append(reportData.getKemidLongTitle())
                    .append("\n\n");
            Paragraph header = new Paragraph(title.toString());
            header.setAlignment(Element.ALIGN_CENTER);
            document.add(header);

            // report table
            float[] colsWidth = { 15f, 17f, 17f, 17f, 17f, 17f };
            PdfPTable table = new PdfPTable(colsWidth);
            table.setWidthPercentage(FULL_TABLE_WIDTH);
            table.getDefaultCell().setPadding(5);

            // column titles
            table.addCell("");
            table.addCell(createCell("UNITS HELD", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("MARKET VALUE", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(
                    createCell("FY REMAINDER ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));
            table.addCell(createCell("NEXT FY ESTIMATED\nANNUAL INCOME", titleFont, Element.ALIGN_RIGHT, true));

            PdfPCell cellCashEquivalnets = new PdfPCell(new Paragraph("CASH AND EQUIVALENTS", cellFont));
            cellCashEquivalnets.setColspan(6);
            table.addCell(cellCashEquivalnets);

            // report groups 
            printReportGroupForNonEndowedDetail(reportData, document, table, cellFont);

            // total
            PdfPCell blank = new PdfPCell(new Paragraph("", cellFont));
            blank.setColspan(6);
            blank.setBackgroundColor(Color.LIGHT_GRAY);
            table.addCell(blank);

            BigDecimal totalKemidMarketValue = reportData
                    .getTotalSumOfMarketValue(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getHistoryIncomeCash()).add(reportData.getHistoryPrincipalCash());
            BigDecimal totalKemidEstimatedAnnualIncome = reportData
                    .getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL));
            BigDecimal totalKemidFYRemainderEstimatedAnnualIncome = reportData
                    .getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfRemainderOfFYEstimated(IncomePrincipalIndicator.PRINCIPAL));
            BigDecimal totalKemidNextFYEstimayedAnnualIncome = reportData
                    .getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.INCOME)
                    .add(reportData.getTotalSumOfNextFYEstimatedIncome(IncomePrincipalIndicator.PRINCIPAL));

            table.addCell(new Paragraph("TOTAL KEMID VALUE", titleFont));
            table.addCell("");
            table.addCell(getAmountCell(totalKemidMarketValue, titleFont));
            table.addCell(getAmountCell(totalKemidEstimatedAnnualIncome, titleFont));
            table.addCell(getAmountCell(totalKemidFYRemainderEstimatedAnnualIncome, titleFont));
            table.addCell(getAmountCell(totalKemidNextFYEstimayedAnnualIncome, titleFont));

            document.add(table);

            // footer
            printFooter(reportData.getFooter(), document);
        }
    } catch (Exception e) {
        LOG.error(e.getMessage());
        return false;
    }

    return true;
}

From source file:org.kuali.kfs.module.endow.report.util.EndowmentReportPrintBase.java

License:Educational Community License

/** 
 * Generates the report header sheet//from w w  w. j a  va  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;
}

From source file:org.kuali.kfs.module.endow.report.util.TransactionStatementReportPrint.java

License:Educational Community License

/**
 * Generates the Transaction Statement report    
 * //from www. j ava 2 s  .c  om
 * @param transactionStatementReports
 * @param document
 * @return
 */
public boolean printTransactionStatementReportBody(
        List<TransactionStatementReportDataHolder> transactionStatementReportDataHolders, Document document) {

    // for each kemid
    try {
        Font cellFont = regularFont;
        for (TransactionStatementReportDataHolder transactionStatementReport : transactionStatementReportDataHolders) {

            // new page
            document.newPage();

            // header
            StringBuffer title = new StringBuffer();
            title.append(transactionStatementReport.getInstitution()).append("\n");
            title.append("STATEMENT OF TRANSACTIONS FROM").append("\n");
            title.append(transactionStatementReport.getBeginningDate()).append(" to ")
                    .append(transactionStatementReport.getEndingDate()).append("\n");
            title.append(transactionStatementReport.getKemid()).append("     ")
                    .append(transactionStatementReport.getKemidLongTitle()).append("\n\n");
            Paragraph header = new Paragraph(title.toString());
            header.setAlignment(Element.ALIGN_CENTER);
            document.add(header);

            // report table
            PdfPTable table = new PdfPTable(4);
            table.setWidthPercentage(FULL_TABLE_WIDTH);
            int[] relativeWidths = { 10, 40, 25, 25 };
            table.setWidths(relativeWidths);
            table.getDefaultCell().setPadding(5);

            // table titles
            table.addCell(new Phrase("DATE", titleFont));
            table.addCell(new Phrase("DESCRIPTION", titleFont));
            table.addCell(
                    createCell("INCOME AMOUNT", titleFont, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, true));
            table.addCell(
                    createCell("PRINCIPAL AMOUNT", titleFont, Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, true));

            // beginning cash balance
            table.addCell(new Phrase(transactionStatementReport.getBeginningDate(), cellFont));
            table.addCell(new Phrase("Beginning Cash Balance", cellFont));
            String amount = "";
            amount = formatAmount(transactionStatementReport.getBeginningIncomeCash());
            table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            amount = formatAmount(transactionStatementReport.getBeginningPrincipalCash());
            table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));

            // transactions
            List<TransactionArchiveInfo> TransactionArchiveInfoList = transactionStatementReport
                    .getTransactionArchiveInfoList();
            for (TransactionArchiveInfo transactionArchiveInfo : TransactionArchiveInfoList) {
                table.addCell(new Phrase(transactionArchiveInfo.getPostedDate(), cellFont));
                table.addCell(new Phrase(getDescription(transactionArchiveInfo), cellFont));
                amount = formatAmount(transactionArchiveInfo.getTransactionIncomeCash());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
                amount = formatAmount(transactionArchiveInfo.getTransactionPrincipalCash());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            }

            // ending cash balance
            table.addCell(new Phrase(transactionStatementReport.getEndingDate(), cellFont));
            table.addCell(new Phrase("Ending Cash Balance", cellFont));
            amount = formatAmount(transactionStatementReport.getEndingIncomeCash());
            table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            amount = formatAmount(transactionStatementReport.getEndingPrincipalCash());
            table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));

            document.add(table);

            // footer
            printFooter(transactionStatementReport.getFooter(), document);
        }

    } 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 write the document header
 * /*from  ww  w  .  j  av  a 2  s.c  o  m*/
 * @param document
 * @param transactionSummaryReport
 */
protected void writeDocumentHeader(Document document,
        TransactionSummaryReportDataHolder transactionSummaryReport) {
    // header
    StringBuffer title = new StringBuffer();
    title.append(transactionSummaryReport.getInstitution()).append("\n");
    title.append("SUMMARY OF ACTIVITY FROM ");
    title.append(transactionSummaryReport.getBeginningDate()).append(" TO ")
            .append(transactionSummaryReport.getEndingDate()).append("\n");
    title.append(transactionSummaryReport.getKemid()).append("     ")
            .append(transactionSummaryReport.getKemidLongTitle()).append("\n\n");
    try {
        Paragraph header = new Paragraph(title.toString());
        header.setAlignment(Element.ALIGN_CENTER);
        document.add(header);
    } catch (DocumentException de) {
        LOG.info("writeDocumentHeader(): Unable to create the header for the report");
    }
}

From source file:org.kuali.kfs.module.endow.report.util.TrialBalanceReportPrint.java

License:Educational Community License

/**
 * Generates the Trial Balance report/*w  w  w .  j  a v  a 2  s.c o m*/
 * 
 * @param trialBalanceReports
 * @param document
 * @return
 */
public boolean printTrialBalanceReportBody(List<TrialBalanceReportDataHolder> trialBalanceReports,
        Document document) {

    try {
        // title
        Paragraph title = new Paragraph("KEMID Trial Balance");
        title.setAlignment(Element.ALIGN_CENTER);
        Date currentDate = SpringContext.getBean(KEMService.class).getCurrentDate();
        DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
        String asOfDate = dateTimeService.toDateString(currentDate);
        title.add("\nAs of " + asOfDate + "\n\n");
        document.add(title);

        // report table
        PdfPTable table = new PdfPTable(7);
        table.setWidthPercentage(FULL_TABLE_WIDTH);
        int[] relativeWidths = { 10, 15, 15, 15, 15, 15, 15 };
        table.setWidths(relativeWidths);
        table.getDefaultCell().setPadding(2);

        // table titles
        table.addCell(new Phrase("KEMID", titleFont));
        table.addCell(new Phrase("KEMID Name", titleFont));
        table.addCell(new Phrase("Income Cash Balance", titleFont));
        table.addCell(new Phrase("Principal Cash Balance", titleFont));
        table.addCell(new Phrase("KEMID Total Market Value", titleFont));
        table.addCell(new Phrase("Available Expendable Funds", titleFont));
        table.addCell(new Phrase("FY Remainder Estimated Income", titleFont));

        // table body
        Font cellFont = regularFont;
        BigDecimal totalIncomeCashBalance = BigDecimal.ZERO;
        BigDecimal totalPrincipalCashBalance = BigDecimal.ZERO;
        BigDecimal totalMarketValueBalance = BigDecimal.ZERO;
        BigDecimal totalAvailableExpendableFundsBalance = BigDecimal.ZERO;
        BigDecimal totalFyRemainderEstimatedIncome = BigDecimal.ZERO;

        for (TrialBalanceReportDataHolder trialBalanceReport : trialBalanceReports) {

            // totals, which is the last row
            if (trialBalanceReport.getKemid().equalsIgnoreCase("TOTALS")) {
                cellFont = titleFont;
            }

            table.addCell(new Phrase(trialBalanceReport.getKemid(), cellFont));
            table.addCell(new Phrase(trialBalanceReport.getKemidName(), cellFont));
            if (trialBalanceReport.getInocmeCashBalance() != null) {
                String amount = formatAmount(trialBalanceReport.getInocmeCashBalance().bigDecimalValue());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
                totalIncomeCashBalance = totalIncomeCashBalance
                        .add(trialBalanceReport.getInocmeCashBalance().bigDecimalValue());
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getPrincipalcashBalance() != null) {
                String amount = formatAmount(trialBalanceReport.getPrincipalcashBalance().bigDecimalValue());
                totalPrincipalCashBalance = totalPrincipalCashBalance
                        .add(trialBalanceReport.getPrincipalcashBalance().bigDecimalValue());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getKemidTotalMarketValue() != null) {
                String amount = formatAmount(trialBalanceReport.getKemidTotalMarketValue());
                totalMarketValueBalance = totalMarketValueBalance
                        .add(trialBalanceReport.getKemidTotalMarketValue());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getAvailableExpendableFunds() != null) {
                String amount = formatAmount(trialBalanceReport.getAvailableExpendableFunds());
                totalAvailableExpendableFundsBalance = totalAvailableExpendableFundsBalance
                        .add(trialBalanceReport.getAvailableExpendableFunds());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
            if (trialBalanceReport.getFyRemainderEstimatedIncome() != null) {
                String amount = formatAmount(trialBalanceReport.getFyRemainderEstimatedIncome());
                totalFyRemainderEstimatedIncome = totalFyRemainderEstimatedIncome
                        .add(trialBalanceReport.getFyRemainderEstimatedIncome());
                table.addCell(createCell(amount, cellFont, Element.ALIGN_RIGHT, true));
            } else {
                table.addCell(createCell(ZERO_FOR_REPORT, cellFont, Element.ALIGN_RIGHT, true));
            }
        }

        // totals
        PdfPCell blank = new PdfPCell(new Paragraph("", cellFont));
        blank.setColspan(7);
        blank.setBackgroundColor(Color.LIGHT_GRAY);
        table.addCell(blank);

        table.addCell(createCell("TOTALS", titleFont, Element.ALIGN_LEFT, true));
        table.addCell(createCell("", cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalIncomeCashBalance), cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalPrincipalCashBalance), cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalMarketValueBalance), cellFont, Element.ALIGN_RIGHT, true));
        table.addCell(createCell(formatAmount(totalAvailableExpendableFundsBalance), cellFont,
                Element.ALIGN_RIGHT, true));
        table.addCell(
                createCell(formatAmount(totalFyRemainderEstimatedIncome), cellFont, Element.ALIGN_RIGHT, true));

        document.add(table);

    } catch (Exception e) {
        return false;
    }

    return true;
}

From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java

License:Open Source License

/**
 * @see org.kuali.kfs.module.tem.pdf.PdfStream#print(java.io.OutputStream)
 * @throws Exception//from   ww w  . jav  a 2s . c  o m
 */
@Override
public void print(final OutputStream stream) throws Exception {
    final Font titleFont = FontFactory.getFont(FontFactory.HELVETICA, 20, Font.BOLD);
    final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
    final Font normalFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL);

    final Document doc = new Document();
    final PdfWriter writer = PdfWriter.getInstance(doc, stream);
    doc.open();
    if (getDocumentNumber() != null) {
        Image image = Image.getInstance(new BarcodeHelper().generateBarcodeImage(getDocumentNumber()), null);
        doc.add(image);
    }

    final Paragraph title = new Paragraph("TEM Coversheet", titleFont);
    doc.add(title);

    final Paragraph faxNumber = new Paragraph(
            "Fax this page to " + SpringContext.getBean(ParameterService.class)
                    .getParameterValueAsString(TravelReimbursementDocument.class, FAX_NUMBER),
            normalFont);
    doc.add(faxNumber);

    final Paragraph header = new Paragraph("", headerFont);
    header.setAlignment(ALIGN_RIGHT);
    header.add("Document Number: " + getDocumentNumber());
    doc.add(header);
    doc.add(getInstructionsParagraph());
    doc.add(getMailtoParagraph());
    doc.add(Chunk.NEWLINE);
    doc.add(getTripInfo());
    doc.add(Chunk.NEWLINE);
    doc.add(getPersonalInfo());
    doc.add(Chunk.NEWLINE);
    doc.add(getExpenses());

    drawAlignmentMarks(writer.getDirectContent());

    doc.close();
    writer.close();
}

From source file:org.kuali.ole.describe.controller.EditorController.java

License:Open Source License

private void generateCallSlip(EditorForm editorForm, HttpServletResponse response) {
    LOG.debug("Creating pdf");
    String title = "", author = "", callNumber = "", location = "", copyNumber = "", enumeration = "",
            chronology = "", barcode = "";
    SearchResponse searchResponse = null;
    SearchParams searchParams = new SearchParams();
    SearchField searchField1 = searchParams.buildSearchField("item", "ItemIdentifier_search",
            editorForm.getDocId());/*w  ww .  j ava2  s .c  o m*/
    searchParams.getSearchConditions().add(searchParams.buildSearchCondition("OR", searchField1, "AND"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("bibliographic", "Title"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("bibliographic", "Author"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "CallNumber"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "LocationName"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "CopyNumber"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "enumeration"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "chronology"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "ItemBarcode"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("holdings", "CallNumber"));
    searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("holdings", "LocationName"));
    try {
        searchResponse = getDocstoreClientLocator().getDocstoreClient().search(searchParams);
    } catch (Exception e) {
        LOG.error(e, e);
    }
    if (CollectionUtils.isNotEmpty(searchResponse.getSearchResults())) {
        for (SearchResultField searchResultField : searchResponse.getSearchResults().get(0)
                .getSearchResultFields()) {
            if (searchResultField.getDocType().equalsIgnoreCase(DocType.BIB.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("Title")) {
                if (StringUtils.isBlank(title)) {
                    title = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
                }
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.BIB.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("Author")) {
                if (StringUtils.isBlank(author)) {
                    author = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
                }
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("CallNumber")) {
                callNumber = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("LocationName")) {
                location = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("CopyNumber")) {
                copyNumber = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("enumeration")) {
                enumeration = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue()
                        : "";
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("chronology")) {
                chronology = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("ItemBarcode")) {
                barcode = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.HOLDINGS.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("CallNumber")) {
                if (StringUtils.isBlank(callNumber)) {
                    callNumber = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue()
                            : "";
                }
            } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.HOLDINGS.getCode())
                    && searchResultField.getFieldName().equalsIgnoreCase("LocationName")) {
                if (StringUtils.isBlank(location)) {
                    location = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue()
                            : "";
                }
            }
        }
    }
    String fileName = "Call/Paging Slip" + "_" + (editorForm.getTitle() != null ? editorForm.getTitle() : "")
            + "_" + new Date(System.currentTimeMillis()) + ".pdf";
    if (LOG.isInfoEnabled()) {
        LOG.info("File Created :" + title + "file name ::" + fileName + "::");
    }
    try {
        Document document = this.getDocument(0, 0, 5, 5);
        OutputStream outputStream = null;
        response.setContentType("application/pdf");
        //response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
        outputStream = response.getOutputStream();
        PdfWriter.getInstance(document, outputStream);
        Font boldFont = new Font(Font.TIMES_ROMAN, 15, Font.BOLD);
        document.open();
        document.newPage();
        PdfPTable pdfTable = new PdfPTable(3);
        pdfTable.setWidths(new int[] { 20, 2, 30 });
        Paragraph paraGraph = new Paragraph();
        paraGraph.setAlignment(Element.ALIGN_CENTER);
        paraGraph.add(new Chunk("Call/Paging Slip", boldFont));
        paraGraph.add(Chunk.NEWLINE);
        paraGraph.add(Chunk.NEWLINE);
        paraGraph.add(Chunk.NEWLINE);
        document.add(paraGraph);

        pdfTable.addCell(getPdfPCellInJustified("Title"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(title));

        pdfTable.addCell(getPdfPCellInJustified("Author"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(author));

        pdfTable.addCell(getPdfPCellInJustified("Call Number"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(callNumber));

        pdfTable.addCell(getPdfPCellInJustified("Location"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(location));

        pdfTable.addCell(getPdfPCellInJustified("Copy Number"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(copyNumber));

        pdfTable.addCell(getPdfPCellInJustified("Enumeration"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(enumeration));

        pdfTable.addCell(getPdfPCellInJustified("Chronology"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(chronology));

        pdfTable.addCell(getPdfPCellInJustified("Barcode"));
        pdfTable.addCell(getPdfPCellInLeft(":"));
        pdfTable.addCell(getPdfPCellInJustified(barcode));

        document.add(pdfTable);
        document.close();
        outputStream.flush();
        outputStream.close();
    } catch (Exception e) {
        LOG.error(e, e);
    }
}