Example usage for com.lowagie.text PageSize B0

List of usage examples for com.lowagie.text PageSize B0

Introduction

In this page you can find the example usage for com.lowagie.text PageSize B0.

Prototype

Rectangle B0

To view the source code for com.lowagie.text PageSize B0.

Click Source Link

Document

This is the b0 format

Usage

From source file:com.gst.infrastructure.dataqueries.service.ReadReportingServiceImpl.java

License:Apache License

@Override
public String retrieveReportPDF(final String reportName, final String type,
        final Map<String, String> queryParams) {

    final String fileLocation = FileSystemContentRepository.FINERACT_BASE_DIR + File.separator + "";
    if (!new File(fileLocation).isDirectory()) {
        new File(fileLocation).mkdirs();
    }/*  w w  w  .  j  a  v a  2 s . co m*/

    final String genaratePdf = fileLocation + File.separator + reportName + ".pdf";

    try {
        final GenericResultsetData result = retrieveGenericResultset(reportName, type, queryParams);

        final List<ResultsetColumnHeaderData> columnHeaders = result.getColumnHeaders();
        final List<ResultsetRowData> data = result.getData();
        List<String> row;

        logger.info("NO. of Columns: " + columnHeaders.size());
        final Integer chSize = columnHeaders.size();

        final Document document = new Document(PageSize.B0.rotate());

        PdfWriter.getInstance(document, new FileOutputStream(new File(fileLocation + reportName + ".pdf")));
        document.open();

        final PdfPTable table = new PdfPTable(chSize);
        table.setWidthPercentage(100);

        for (int i = 0; i < chSize; i++) {

            table.addCell(columnHeaders.get(i).getColumnName());

        }
        table.completeRow();

        Integer rSize;
        String currColType;
        String currVal;
        logger.info("NO. of Rows: " + data.size());
        for (int i = 0; i < data.size(); i++) {
            row = data.get(i).getRow();
            rSize = row.size();
            for (int j = 0; j < rSize; j++) {
                currColType = columnHeaders.get(j).getColumnType();
                currVal = row.get(j);
                if (currVal != null) {
                    if (currColType.equals("DECIMAL") || currColType.equals("DOUBLE")
                            || currColType.equals("BIGINT") || currColType.equals("SMALLINT")
                            || currColType.equals("INT")) {

                        table.addCell(currVal.toString());
                    } else {
                        table.addCell(currVal.toString());
                    }
                }
            }
        }
        table.completeRow();
        document.add(table);
        document.close();
        return genaratePdf;
    } catch (final Exception e) {
        logger.error("error.msg.reporting.error:" + e.getMessage());
        throw new PlatformDataIntegrityException("error.msg.exception.error", e.getMessage());
    }
}

From source file:include.nseer_cookie.printPDF.java

License:Open Source License

public Document print_type_across(String print_type, int print_left, int print_right, int print_top,
        int print_bottom) {

    try {//from   www  .  ja  v a  2 s  .c  o m

        if (print_type.equals("A0"))
            document = new Document(PageSize.A0.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A1"))
            document = new Document(PageSize.A1.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A2"))
            document = new Document(PageSize.A2.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A3"))
            document = new Document(PageSize.A3.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A4"))
            document = new Document(PageSize.A4.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A5"))
            document = new Document(PageSize.A5.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A6"))
            document = new Document(PageSize.A6.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A7"))
            document = new Document(PageSize.A7.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A8"))
            document = new Document(PageSize.A8.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A9"))
            document = new Document(PageSize.A9.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B0"))
            document = new Document(PageSize.B0.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B1"))
            document = new Document(PageSize.B1.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B2"))
            document = new Document(PageSize.B2.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B3"))
            document = new Document(PageSize.B3.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B4"))
            document = new Document(PageSize.B4.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B5"))
            document = new Document(PageSize.B5.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_A"))
            document = new Document(PageSize.ARCH_A.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_B"))
            document = new Document(PageSize.ARCH_B.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_C"))
            document = new Document(PageSize.ARCH_C.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_D"))
            document = new Document(PageSize.ARCH_D.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_E"))
            document = new Document(PageSize.ARCH_E.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSA"))
            document = new Document(PageSize.FLSA.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSE"))
            document = new Document(PageSize.FLSE.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("NOTE"))
            document = new Document(PageSize.NOTE.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("_11X17"))
            document = new Document(PageSize._11X17.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("LETTER"))
            document = new Document(PageSize.LETTER.rotate(), print_left, print_right, print_top, print_bottom);
        if (print_type.equals("HALFLETTER"))
            document = new Document(PageSize.HALFLETTER.rotate(), print_left, print_right, print_top,
                    print_bottom);
        if (print_type.equals("LEDGER"))
            document = new Document(PageSize.LEDGER.rotate(), print_left, print_right, print_top, print_bottom);

    } catch (Exception e) {
        e.printStackTrace();
    }
    return document;
}

From source file:include.nseer_cookie.printPDF.java

License:Open Source License

public Document print_type_vertical(String print_type, int print_left, int print_right, int print_top,
        int print_bottom) {

    try {//from w ww . j  av a  2  s.  c om
        if (print_type.equals("A0"))
            document = new Document(PageSize.A0, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A1"))
            document = new Document(PageSize.A1, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A2"))
            document = new Document(PageSize.A2, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A3"))
            document = new Document(PageSize.A3, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A4"))
            document = new Document(PageSize.A4, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A5"))
            document = new Document(PageSize.A5, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A6"))
            document = new Document(PageSize.A6, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A7"))
            document = new Document(PageSize.A7, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A8"))
            document = new Document(PageSize.A8, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("A9"))
            document = new Document(PageSize.A9, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B0"))
            document = new Document(PageSize.B0, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B1"))
            document = new Document(PageSize.B1, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B2"))
            document = new Document(PageSize.B2, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B3"))
            document = new Document(PageSize.B3, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B4"))
            document = new Document(PageSize.B4, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("B5"))
            document = new Document(PageSize.B5, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_A"))
            document = new Document(PageSize.ARCH_A, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_B"))
            document = new Document(PageSize.ARCH_B, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_C"))
            document = new Document(PageSize.ARCH_C, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_D"))
            document = new Document(PageSize.ARCH_D, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("ARCH_E"))
            document = new Document(PageSize.ARCH_E, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSA"))
            document = new Document(PageSize.FLSA, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("FLSE"))
            document = new Document(PageSize.FLSE, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("NOTE"))
            document = new Document(PageSize.NOTE, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("_11X17"))
            document = new Document(PageSize._11X17, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("LETTER"))
            document = new Document(PageSize.LETTER, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("HALFLETTER"))
            document = new Document(PageSize.HALFLETTER, print_left, print_right, print_top, print_bottom);
        if (print_type.equals("LEDGER"))
            document = new Document(PageSize.LEDGER, print_left, print_right, print_top, print_bottom);

    } catch (Exception e) {
        e.printStackTrace();
    }
    return document;
}

From source file:org.mifosplatform.infrastructure.dataqueries.service.ReadReportingServiceImpl.java

License:Mozilla Public License

@Override
public String retrieveReportPDF(final String reportName, final String type,
        final Map<String, String> queryParams) {

    final String fileLocation = FileSystemContentRepository.MIFOSX_BASE_DIR + File.separator + "";
    if (!new File(fileLocation).isDirectory()) {
        new File(fileLocation).mkdirs();
    }/*from w w w .jav  a2  s  . c  o m*/

    final String genaratePdf = fileLocation + File.separator + reportName + ".pdf";

    try {
        final GenericResultsetData result = retrieveGenericResultset(reportName, type, queryParams);

        final List<ResultsetColumnHeaderData> columnHeaders = result.getColumnHeaders();
        final List<ResultsetRowData> data = result.getData();
        List<String> row;

        logger.info("NO. of Columns: " + columnHeaders.size());
        final Integer chSize = columnHeaders.size();

        final Document document = new Document(PageSize.B0.rotate());

        PdfWriter.getInstance(document, new FileOutputStream(new File(fileLocation + reportName + ".pdf")));
        document.open();

        final PdfPTable table = new PdfPTable(chSize);
        table.setWidthPercentage(100);

        for (int i = 0; i < chSize; i++) {

            table.addCell(columnHeaders.get(i).getColumnName());

        }
        table.completeRow();

        Integer rSize;
        String currColType;
        String currVal;
        logger.info("NO. of Rows: " + data.size());
        for (int i = 0; i < data.size(); i++) {
            row = data.get(i).getRow();
            rSize = row.size();
            for (int j = 0; j < rSize; j++) {
                currColType = columnHeaders.get(j).getColumnType();
                currVal = row.get(j);
                if (currVal != null) {
                    if (currColType.equals("DECIMAL") || currColType.equals("DOUBLE")
                            || currColType.equals("BIGINT") || currColType.equals("SMALLINT")
                            || currColType.equals("INT")) {

                        table.addCell(currVal.toString());
                    } else {
                        table.addCell(currVal.toString());
                    }
                }
            }
        }
        table.completeRow();
        document.add(table);
        document.close();
        return genaratePdf;
    } catch (final Exception e) {
        logger.error("error.msg.reporting.error:" + e.getMessage());
        throw new PlatformDataIntegrityException("error.msg.exception.error", e.getMessage());
    }
}