Example usage for javax.print.attribute.standard Sides ONE_SIDED

List of usage examples for javax.print.attribute.standard Sides ONE_SIDED

Introduction

In this page you can find the example usage for javax.print.attribute.standard Sides ONE_SIDED.

Prototype

Sides ONE_SIDED

To view the source code for javax.print.attribute.standard Sides ONE_SIDED.

Click Source Link

Document

Imposes each consecutive print-stream page upon the same side of consecutive media sheets.

Usage

From source file:net.sourceforge.fenixedu.util.report.ReportsUtils.java

private static void print(PrintService printService, byte[] pdf) throws PrintException {
    final DocPrintJob job = printService.createPrintJob();
    final Doc doc = new SimpleDoc(pdf, DocFlavor.BYTE_ARRAY.PDF, null);

    final PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(new Copies(1));
    aset.add(MediaSizeName.ISO_A4);
    aset.add(Sides.ONE_SIDED);

    job.print(doc, aset);/*from ww w.  ja va2 s .co  m*/
}

From source file:org.apache.camel.component.printer.PrinterConfiguration.java

public Sides assignSides(String sidesString) {
    Sides answer;//  w  w  w .java 2  s .com

    if (sidesString == null) {
        // default to one side if no slides configured
        answer = Sides.ONE_SIDED;
    } else if (sidesString.equalsIgnoreCase("one-sided")) {
        answer = Sides.ONE_SIDED;
    } else if (sidesString.equalsIgnoreCase("duplex")) {
        answer = Sides.DUPLEX;
    } else if (sidesString.equalsIgnoreCase("tumble")) {
        answer = Sides.TUMBLE;
    } else if (sidesString.equalsIgnoreCase("two-sided-short-edge")) {
        answer = Sides.TWO_SIDED_SHORT_EDGE;
    } else if (sidesString.equalsIgnoreCase("two-sided-long-edge")) {
        answer = Sides.TWO_SIDED_LONG_EDGE;
    } else {
        answer = Sides.ONE_SIDED;
    }

    return answer;
}

From source file:org.apache.camel.component.printer.PrinterOperations.java

public PrinterOperations() throws PrintException {
    printService = PrintServiceLookup.lookupDefaultPrintService();
    if (printService == null) {
        throw new PrintException("Printer lookup failure. No default printer set up for this host");
    }/*from  w w  w.  j  a  v  a2 s .c o  m*/
    job = printService.createPrintJob();
    flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
    printRequestAttributeSet = new HashPrintRequestAttributeSet();
    printRequestAttributeSet.add(new Copies(1));
    printRequestAttributeSet.add(MediaSizeName.NA_LETTER);
    printRequestAttributeSet.add(Sides.ONE_SIDED);
}