/******************************************************************************* * Copyright (c) 2000, 2011 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.printing; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; /** * Instances of this class are descriptions of a print job * in terms of the printer, and the scope and type of printing * that is desired. For example, the number of pages and copies * can be specified, as well as whether or not the print job * should go to a file. *
* Application code does not need to explicitly release the
* resources managed by each instance when those instances are no longer
* required, and thus no dispose()
method is provided.
*
ALL_PAGES
PAGE_RANGE
SELECTION
SWT.DEFAULT
DUPLEX_NONE
DUPLEX_LONG_EDGE
DUPLEX_SHORT_EDGE
* The default value is SWT.DEFAULT
, meaning do not set a value;
* use the printer's default duplex setting.
* A printer's default value is typically single-sided,
* however it can default to double-sided in order to save paper.
*
scope
field value indicating that
* all pages should be printed
*/
public static final int ALL_PAGES = 0;
/**
* scope
field value indicating that
* the range of pages specified by startPage and endPage
* should be printed
*/
public static final int PAGE_RANGE = 1;
/**
* scope
field value indicating that
* the current selection should be printed
*/
public static final int SELECTION = 2;
/**
* orientation
field value indicating
* portrait paper orientation
*
* @since 3.5
*/
public static final int PORTRAIT = 1;
/**
* orientation
field value indicating
* landscape paper orientation
*
* @since 3.5
*/
public static final int LANDSCAPE = 2;
/**
* duplex
field value indicating
* single-sided printing.
* * This is also known as simplex printing. *
* * @since 3.7 */ public static final int DUPLEX_NONE = 0; /** *duplex
field value indicating
* double-sided printing for binding on the long edge.
* * For portrait orientation, the long edge is vertical. * For landscape orientation, the long edge is horizontal. *
* This is also known as duplex printing. *
* * @since 3.7 */ public static final int DUPLEX_LONG_EDGE = 1; /** *duplex
field value indicating
* double-sided printing for binding on the short edge.
* * For portrait orientation, the short edge is horizontal. * For landscape orientation, the short edge is vertical. *
* This is also known as duplex tumble printing. *
* * @since 3.7 */ public static final int DUPLEX_SHORT_EDGE = 2; /** * private, platform-specific data * On Windows, this contains a copy of the DEVMODE struct * returned from thePrintDialog
.
* On GTK, this contains a copy of the print_settings and page_setup
* returned from the PrintDialog
.
* On OS X Cocoa, this contains a copy of the PrintSettings and PageFormat
* returned from the PrintDialog
.
* This field is not currently used on the X/Window System.
*/
byte [] otherData;
/**
* Constructs an instance of this class that can be
* used to print to the default printer.
*
* @see Printer#getDefaultPrinterData
*/
public PrinterData() {
}
/**
* Constructs an instance of this class with the given
* printer driver and printer name.
*
* @param driver the printer driver for the printer
* @param name the name of the printer
*
* @see #driver
* @see #name
*/
public PrinterData(String driver, String name) {
this.driver = driver;
this.name = name;
}
/**
* Returns a string containing a concise, human-readable
* description of the receiver.
*
* @return a string representation of the receiver
*/
@Override
public String toString() {
return "PrinterData {" + "driver = " + driver + ", name = " + name + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}