Example usage for com.lowagie.text PageSize LEDGER

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

Introduction

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

Prototype

Rectangle LEDGER

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

Click Source Link

Document

This is the ledger 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 {/* w  w  w  .  ja  v  a2 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 {/*  w ww  .j  ava2  s  .  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.tn5250j.spoolfile.SpoolExportWizard.java

License:Open Source License

/**
 * Open the correct type of output file depending on selection(s)
 *//* w  w w  .j  a v  a 2 s  . com*/
public void openOutputFile() {

    try {

        // update status
        updateStatus("Opening File");

        // default to txt extention
        String suffix = ".txt";
        String fileName = "";

        // if pdf then change to pdf extenstion
        if (cvtType.getSelectedIndex() == 0)
            suffix = ".pdf";

        // for e-mailing setup a temporary file
        if (email.isSelected()) {
            File dir = new File(System.getProperty("user.dir"));

            //  setup the temp file name
            String tempFile = spooledFile.getText().trim() + '_' + jobName.getText().trim() + '_'
                    + user.getText().trim() + '_' + spooledFileNumber.getText().trim() + '_'
                    + number.getText().trim();

            // create the temporary file
            File f = File.createTempFile(tempFile, suffix, dir);

            System.out.println(f.getName());
            System.out.println(f.getCanonicalPath());

            conicalPath = f.getCanonicalPath();

            // set it to delete on exit
            f.deleteOnExit();

            // create the file
            fw = new FileOutputStream(f);
        } else

        if (ifs.isSelected()) {
            fileName = ifsPathInfo.getText().trim();
            ifsfw = new IFSFileOutputStream(splfile.getSystem(), fileName);
        } else {
            fileName = pcPathInfo.getText().trim();
            fw = new FileOutputStream(fileName);
        }

        // if not PDF then this is all we have to do so return
        if (cvtType.getSelectedIndex() > 0)
            return;

        // On pdf's then we need to create a PDF document
        if (document == null) {

            document = new Document();

            // create the pdf writer based on selection of pc or ifs file
            if (ifs.isSelected()) {
                bos = PdfWriter.getInstance(document, ifsfw);
            } else {
                bos = PdfWriter.getInstance(document, fw);
            }

            // create the base font
            BaseFont bf = BaseFont.createFont("Courier", "Cp1252", false);

            // set the default size of the font to 9.0
            float fontsize = 9.0f;

            // if we have a font selectd then try to use it
            if (fontSize.getText().length() > 0)
                fontsize = Float.parseFloat(fontSize.getText().trim());

            // create the pdf font to use within the document
            font = new com.lowagie.text.Font(bf, fontsize, com.lowagie.text.Font.NORMAL);

            // set the PDF properties of the supplied properties
            if (author.getText().length() > 0)
                document.addAuthor(author.getText());
            if (title.getText().length() > 0)
                document.addTitle(title.getText());
            if (subject.getText().length() > 0)
                document.addSubject(subject.getText());

            // set the page sizes and the page orientation
            String ps = (String) pageSize.getSelectedItem();

            if (ps.equals("A3")) {
                if (portrait.isSelected())
                    document.setPageSize(PageSize.A3);
                else
                    document.setPageSize(PageSize.A3.rotate());

            }

            if (ps.equals("A4")) {
                if (portrait.isSelected())
                    document.setPageSize(PageSize.A4);
                else
                    document.setPageSize(PageSize.A4.rotate());
            }

            if (ps.equals("A5")) {
                if (portrait.isSelected())
                    document.setPageSize(PageSize.A5);
                else
                    document.setPageSize(PageSize.A5.rotate());
            }
            if (ps.equals("LETTER")) {
                if (portrait.isSelected())
                    document.setPageSize(PageSize.LETTER);
                else
                    document.setPageSize(PageSize.LETTER.rotate());
            }
            if (ps.equals("LEGAL")) {
                if (portrait.isSelected())
                    document.setPageSize(PageSize.LEGAL);
                else
                    document.setPageSize(PageSize.LEGAL.rotate());
            }
            if (ps.equals("LEDGER")) {
                if (portrait.isSelected())
                    document.setPageSize(PageSize.LEDGER);
                else
                    document.setPageSize(PageSize.LEDGER.rotate());
            }
        }
    } catch (IOException _ex) {
        System.out.println("Cannot open 1 " + _ex.getMessage());

    } catch (Exception _ex2) {
        System.out.println("Cannot open 2 " + _ex2.getMessage());
    }

}

From source file:org.unitime.timetable.reports.PdfLegacyReport.java

License:Open Source License

public void open(OutputStream out, int mode) throws DocumentException, IOException {
    iOut = out;// w w  w. j a  va  2 s .  co  m
    if (mode == sModeText) {
        iPrint = new PrintWriter(iOut);
    } else {
        iNrLines = (mode == sModeLedger ? 116 : 50);
        iDoc = new Document(mode == sModeLedger ? PageSize.LEDGER.rotate() : PageSize.LETTER.rotate());

        PdfWriter.getInstance(iDoc, iOut);

        iDoc.addTitle(iTitle);
        iDoc.addAuthor("UniTime " + Constants.getVersion() + ", www.unitime.org");
        iDoc.addSubject(iSubject);
        iDoc.addCreator("UniTime " + Constants.getVersion() + ", www.unitime.org");

        iDoc.open();
    }
    iEmpty = true;
    iPageNo = 0;
    iLineNo = 0;
}