Example usage for com.lowagie.text PageSize A7

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

Introduction

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

Prototype

Rectangle A7

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

Click Source Link

Document

This is the a7 format

Usage

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  w w  w . j a  v a2s.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 2s  .com
        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.posterita.businesslogic.performanceanalysis.POSReportManager.java

License:Open Source License

public static String endOfTheDayPDF(Properties ctx, CloseTillBean bean) throws OperationException {
    String reportName = RandomStringGenerator.randomstring() + ".pdf";
    String reportPath = ReportManager.getReportPath(reportName);

    double beginningBalance = (bean.getBeginningBalance() == null ? 0
            : bean.getBeginningBalance().doubleValue());
    double statementDifference = (bean.getNetCashTrx() == null ? 0 : bean.getNetCashTrx().doubleValue());
    double transferAmount = (bean.getBalanceEntered() == null ? 0 : bean.getBalanceEntered().doubleValue());
    double differenceAmount = (bean.getDifference() == null ? 0 : bean.getDifference().doubleValue());
    double endingBalance = (bean.getEndingBalance() == null ? 0 : bean.getEndingBalance().doubleValue());
    double tillCashTotal = (bean.getCashTotal() == null ? 0 : bean.getCashTotal().doubleValue());
    double cashBeanCardTotal = (bean.getCardTotal() == null ? 0 : bean.getCardTotal().doubleValue());
    double tillCardTotal = (bean.getCardTotal() == null ? 0 : bean.getCardTotal().doubleValue());
    double cardDifference = (bean.getCardDifference() == null ? 0 : bean.getCardDifference().doubleValue());
    double cashBeanChequeTotal = (bean.getChequeTotal() == null ? 0 : bean.getChequeTotal().doubleValue());
    double tillChequeTotal = (bean.getChequeTotal() == null ? 0 : bean.getChequeTotal().doubleValue());
    double chequeDifference = (bean.getChequeDifference() == null ? 0
            : bean.getChequeDifference().doubleValue());
    double grandTotal = (bean.getGrandTotal() == null ? 0 : bean.getGrandTotal().doubleValue());

    Font titleFont = new Font(Font.TIMES_ROMAN, 8, Font.BOLD);
    Font subtitleFont = new Font(Font.TIMES_ROMAN, 8, Font.BOLD);

    // Font headerFont = new Font(Font.TIMES_ROMAN, 8,Font.BOLD);
    Font simpleFont = new Font(Font.TIMES_ROMAN, 8);

    final float NO_BORDER = 0.0f;
    // final float THIN_BORDER = 1.0f;

    String currency = "Rs ";
    NumberFormat formatter = new DecimalFormat("###,###,##0.00");
    PdfPCell cell = null;/*from w  w w.  j  a v  a 2 s.  c  om*/

    // step 1: creation of a document-object
    Document document = new Document(PageSize.A7, 3, 3, 2, 4);// l,r,t,b
    // document.getPageSize().set;

    System.out.println(document.leftMargin());

    try {
        currency = POSTerminalManager.getDefaultSalesCurrency(ctx).getCurSymbol();
        PdfWriter.getInstance(document, new FileOutputStream(reportPath));

        document.open();

        PdfPTable layoutTbl = new PdfPTable(1);
        layoutTbl.getDefaultCell().setBorderWidth(NO_BORDER);
        layoutTbl.getDefaultCell().setPadding(2.0f);

        SimpleDateFormat sdf = new SimpleDateFormat(TimestampConvertor.DEFAULT_DATE_PATTERN1);
        Date today = new Date(System.currentTimeMillis());

        // 1.add title
        Paragraph title = new Paragraph(new Chunk("End of the Day Report", titleFont));
        title.setAlignment(Paragraph.ALIGN_CENTER);
        cell = new PdfPCell(title);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorderWidth(NO_BORDER);
        layoutTbl.addCell(cell);

        Paragraph subTitle = new Paragraph(new Chunk(sdf.format(today), subtitleFont));
        subTitle.setAlignment(Paragraph.ALIGN_CENTER);
        cell = new PdfPCell(subTitle);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorderWidth(NO_BORDER);
        layoutTbl.addCell(cell);

        // spacing
        cell = new PdfPCell(new Paragraph(""));
        cell.setFixedHeight(10);
        cell.setBorderWidth(NO_BORDER);
        layoutTbl.addCell(cell);

        // display report data
        PdfPTable table = new PdfPTable(2);
        Phrase phrase = null;

        // row 1
        phrase = new Phrase("Till No:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(bean.getTillName(), simpleFont);
        table.addCell(phrase);

        // row 2
        phrase = new Phrase("Begining Balance:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(beginningBalance), simpleFont);
        table.addCell(phrase);

        // row 3
        phrase = new Phrase("Net Cash Trx:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(statementDifference), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Till Balance Entered:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(transferAmount), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Difference:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(differenceAmount), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Ending Balance:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(endingBalance), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Cash Total:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(tillCashTotal), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Card Amt Entered:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(cashBeanCardTotal), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Card Total:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(tillCardTotal), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Card Difference:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(cardDifference), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Cheque Amt Entered:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(cashBeanChequeTotal), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Cheque Total:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(tillChequeTotal), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Cheque Difference:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(chequeDifference), simpleFont);
        table.addCell(phrase);

        phrase = new Phrase("Grand Total:", simpleFont);
        table.addCell(phrase);

        phrase = new Phrase(currency + formatter.format(grandTotal), simpleFont);
        table.addCell(phrase);

        layoutTbl.addCell(table);

        document.add(layoutTbl);

    } catch (Exception e) {
        throw new OperationException(e);
    }

    document.close();

    return reportName;

}

From source file:questions.objects.DifferentLeadings.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A7);
    try {/*from w  w  w . ja v  a 2  s . c o m*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT));
        document.open();
        Chunk space = new Chunk(' ');
        String text = "Quick brown fox jumps over the lazy dog.";
        Phrase phrase1 = new Phrase(text, new Font(Font.HELVETICA, 12));
        Phrase phrase2 = new Phrase(new Chunk(text, new Font(Font.TIMES_ROMAN, 24)));
        Phrase phrase3 = new Phrase(text, new Font(Font.COURIER, 8));
        Phrase phrase4 = new Phrase(text, new Font(Font.HELVETICA, 4));
        Paragraph paragraph = new Paragraph();
        paragraph.add(phrase1);
        paragraph.add(space);
        paragraph.add(phrase2);
        paragraph.add(space);
        paragraph.add(phrase3);
        paragraph.add(space);
        paragraph.add(phrase4);
        paragraph.setMultipliedLeading(1.5f);
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        ColumnText column = new ColumnText(writer.getDirectContent());
        column.setSimpleColumn(document.left(), document.bottom(), document.right(), document.top());
        column.addElement(paragraph);
        column.go();
        document.newPage();
        document.add(paragraph);
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}