FileDocCategorySizeDatePackage
JobAttributes.javaAPI DocJava SE 5 API39075Fri Aug 26 14:56:46 BST 2005java.awt

JobAttributes

public final class JobAttributes extends Object implements Cloneable
A set of attributes which control a print job.

Instances of this class control the number of copies, default selection, destination, print dialog, file and printer names, page ranges, multiple document handling (including collation), and multi-page imposition (such as duplex) of every print job which uses the instance. Attribute names are compliant with the Internet Printing Protocol (IPP) 1.1 where possible. Attribute values are partially compliant where possible.

To use a method which takes an inner class type, pass a reference to one of the constant fields of the inner class. Client code cannot create new instances of the inner class types because none of those classes has a public constructor. For example, to set the print dialog type to the cross-platform, pure Java print dialog, use the following code:

import java.awt.JobAttributes;

public class PureJavaPrintDialogExample {
public void setPureJavaPrintDialog(JobAttributes jobAttributes) {
jobAttributes.setDialog(JobAttributes.DialogType.COMMON);
}
}

Every IPP attribute which supports an attributeName-default value has a corresponding setattributeNameToDefault method. Default value fields are not provided.

version
1.9, 12/19/03
author
David Mendenhall

Fields Summary
private int
copies
private DefaultSelectionType
defaultSelection
private DestinationType
destination
private DialogType
dialog
private String
fileName
private int
fromPage
private int
maxPage
private int
minPage
private MultipleDocumentHandlingType
multipleDocumentHandling
private int[]
pageRanges
private int
prFirst
private int
prLast
private String
printer
private SidesType
sides
private int
toPage
Constructors Summary
public JobAttributes()
Constructs a JobAttributes instance with default values for every attribute. The dialog defaults to DialogType.NATIVE. Min page defaults to 1. Max page defaults to Integer.MAX_VALUE. Destination defaults to DestinationType.PRINTER. Selection defaults to DefaultSelectionType.ALL. Number of copies defaults to 1. Multiple document handling defaults to MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES. Sides defaults to SidesType.ONE_SIDED. File name defaults to null.

        setCopiesToDefault();
	setDefaultSelection(DefaultSelectionType.ALL);
	setDestination(DestinationType.PRINTER);
	setDialog(DialogType.NATIVE);
	setMaxPage(Integer.MAX_VALUE);
	setMinPage(1);
	setMultipleDocumentHandlingToDefault();
	setSidesToDefault();
    
public JobAttributes(JobAttributes obj)
Constructs a JobAttributes instance which is a copy of the supplied JobAttributes.

param
obj the JobAttributes to copy

        set(obj);
    
public JobAttributes(int copies, DefaultSelectionType defaultSelection, DestinationType destination, DialogType dialog, String fileName, int maxPage, int minPage, MultipleDocumentHandlingType multipleDocumentHandling, int[] pageRanges, String printer, SidesType sides)
Constructs a JobAttributes instance with the specified values for every attribute.

param
copies an integer greater than 0
param
defaultSelection DefaultSelectionType.ALL, DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION
param
destination DesintationType.FILE or DesintationType.PRINTER
param
dialog DialogType.COMMON, DialogType.NATIVE, or DialogType.NONE
param
fileName the possibly null file name
param
maxPage an integer greater than zero and greater than or equal to minPage
param
minPage an integer greater than zero and less than or equal to maxPage
param
multipleDocumentHandling MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
param
pageRanges an array of integer arrays of two elements; an array is interpreted as a range spanning all pages including and between the specified pages; ranges must be in ascending order and must not overlap; specified page numbers cannot be less than minPage nor greater than maxPage; for example:
(new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 },
new int[] { 15, 19 } }),
specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19. Note that (new int[][] { new int[] { 1, 1 }, new int[] { 1, 2 } }), is an invalid set of page ranges because the two ranges overlap
param
printer the possibly null printer name
param
sides SidesType.ONE_SIDED, SidesType.TWO_SIDED_LONG_EDGE, or SidesType.TWO_SIDED_SHORT_EDGE
throws
IllegalArgumentException if one or more of the above conditions is violated

        setCopies(copies);
	setDefaultSelection(defaultSelection);
	setDestination(destination);
	setDialog(dialog);
	setFileName(fileName);
	setMaxPage(maxPage);
	setMinPage(minPage);
	setMultipleDocumentHandling(multipleDocumentHandling);
	setPageRanges(pageRanges);
	setPrinter(printer);
	setSides(sides);
    
Methods Summary
public java.lang.Objectclone()
Creates and returns a copy of this JobAttributes.

return
the newly created copy; it is safe to cast this Object into a JobAttributes

        try {
	    return super.clone();
	} catch (CloneNotSupportedException e) {
	    // Since we implement Cloneable, this should never happen
	    throw new InternalError();
	}
    
public booleanequals(java.lang.Object obj)
Determines whether two JobAttributes are equal to each other.

Two JobAttributes are equal if and only if each of their attributes are equal. Attributes of enumeration type are equal if and only if the fields refer to the same unique enumeration object. A set of page ranges is equal if and only if the sets are of equal length, each range enumerates the same pages, and the ranges are in the same order.

param
obj the object whose equality will be checked.
return
whether obj is equal to this JobAttribute according to the above criteria.

        if (!(obj instanceof JobAttributes)) {
	    return false;
	}
	JobAttributes rhs = (JobAttributes)obj;

	if (fileName == null) {
	    if (rhs.fileName != null) {
	        return false;
	    }
	} else {
	    if (!fileName.equals(rhs.fileName)) {
	        return false;
	    }
	}

	if (pageRanges == null) {
	    if (rhs.pageRanges != null) {
	        return false;
	    }
	} else {
	    if (rhs.pageRanges == null ||
		    pageRanges.length != rhs.pageRanges.length) {
	        return false;
	    }
	    for (int i = 0; i < pageRanges.length; i++) {
	        if (pageRanges[i][0] != rhs.pageRanges[i][0] ||
		    pageRanges[i][1] != rhs.pageRanges[i][1]) {
		    return false;
		}
	    }
	}

	if (printer == null) {
	    if (rhs.printer != null) {
	        return false;
	    }
	} else {
	    if (!printer.equals(rhs.printer)) {
	        return false;
	    }
	}

	return (copies == rhs.copies &&
		defaultSelection == rhs.defaultSelection &&
		destination == rhs.destination &&
		dialog == rhs.dialog &&
		fromPage == rhs.fromPage &&
		maxPage == rhs.maxPage &&
		minPage == rhs.minPage &&
		multipleDocumentHandling == rhs.multipleDocumentHandling &&
		prFirst == rhs.prFirst &&
		prLast == rhs.prLast &&
		sides == rhs.sides &&
		toPage == rhs.toPage);
    
public intgetCopies()
Returns the number of copies the application should render for jobs using these attributes. This attribute is updated to the value chosen by the user.

return
an integer greater than 0.

        return copies;
    
public java.awt.JobAttributes$DefaultSelectionTypegetDefaultSelection()
Specifies whether, for jobs using these attributes, the application should print all pages, the range specified by the return value of getPageRanges, or the current selection. This attribute is updated to the value chosen by the user.

return
DefaultSelectionType.ALL, DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION

        return defaultSelection;
    
public java.awt.JobAttributes$DestinationTypegetDestination()
Specifies whether output will be to a printer or a file for jobs using these attributes. This attribute is updated to the value chosen by the user.

return
DesintationType.FILE or DesintationType.PRINTER

        return destination;
    
public java.awt.JobAttributes$DialogTypegetDialog()
Returns whether, for jobs using these attributes, the user should see a print dialog in which to modify the print settings, and which type of print dialog should be displayed. DialogType.COMMON denotes a cross- platform, pure Java print dialog. DialogType.NATIVE denotes the platform's native print dialog. If a platform does not support a native print dialog, the pure Java print dialog is displayed instead. DialogType.NONE specifies no print dialog (i.e., background printing). This attribute cannot be modified by, and is not subject to any limitations of, the implementation or the target printer.

return
DialogType.COMMON, DialogType.NATIVE, or DialogType.NONE

        return dialog;
    
public java.lang.StringgetFileName()
Specifies the file name for the output file for jobs using these attributes. This attribute is updated to the value chosen by the user.

return
the possibly null file name

        return fileName;
    
public intgetFromPage()
Returns, for jobs using these attributes, the first page to be printed, if a range of pages is to be printed. This attribute is updated to the value chosen by the user. An application should ignore this attribute on output, unless the return value of the getDefaultSelection method is DefaultSelectionType.RANGE. An application should honor the return value of getPageRanges over the return value of this method, if possible.

return
an integer greater than zero and less than or equal to toPage and greater than or equal to minPage and less than or equal to maxPage.

        if (fromPage != 0) {
	    return fromPage;
	} else if (toPage != 0) {
	    return getMinPage();
	} else if (pageRanges != null) {
	    return prFirst;
	} else {
	    return getMinPage();
	}
    
public intgetMaxPage()
Specifies the maximum value the user can specify as the last page to be printed for jobs using these attributes. This attribute cannot be modified by, and is not subject to any limitations of, the implementation or the target printer.

return
an integer greater than zero and greater than or equal to minPage.

        return maxPage;
    
public intgetMinPage()
Specifies the minimum value the user can specify as the first page to be printed for jobs using these attributes. This attribute cannot be modified by, and is not subject to any limitations of, the implementation or the target printer.

return
an integer greater than zero and less than or equal to maxPage.

        return minPage;
    
public java.awt.JobAttributes$MultipleDocumentHandlingTypegetMultipleDocumentHandling()
Specifies the handling of multiple copies, including collation, for jobs using these attributes. This attribute is updated to the value chosen by the user.

return
MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.

        return multipleDocumentHandling;
    
public int[][]getPageRanges()
Specifies, for jobs using these attributes, the ranges of pages to be printed, if a range of pages is to be printed. All range numbers are inclusive. This attribute is updated to the value chosen by the user. An application should ignore this attribute on output, unless the return value of the getDefaultSelection method is DefaultSelectionType.RANGE.

return
an array of integer arrays of 2 elements. An array is interpreted as a range spanning all pages including and between the specified pages. Ranges must be in ascending order and must not overlap. Specified page numbers cannot be less than minPage nor greater than maxPage. For example: (new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 }, new int[] { 15, 19 } }), specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19.

        if (pageRanges != null) {
	    // Return a copy because otherwise client code could circumvent the
	    // the checks made in setPageRanges by modifying the returned
	    // array.
	    int[][] copy = new int[pageRanges.length][2];
	    for (int i = 0; i < pageRanges.length; i++) {
		copy[i][0] = pageRanges[i][0];
		copy[i][1] = pageRanges[i][1];
	    }
	    return copy;
	} else if (fromPage != 0 || toPage != 0) {
	    int fromPage = getFromPage();
	    int toPage = getToPage();
	    return new int[][] { new int[] { fromPage, toPage } };
	} else {
	    int minPage = getMinPage();
	    return new int[][] { new int[] { minPage, minPage } };
	}
    
public java.lang.StringgetPrinter()
Returns the destination printer for jobs using these attributes. This attribute is updated to the value chosen by the user.

return
the possibly null printer name.

        return printer;
    
public java.awt.JobAttributes$SidesTypegetSides()
Returns how consecutive pages should be imposed upon the sides of the print medium for jobs using these attributes. SidesType.ONE_SIDED imposes each consecutive page upon the same side of consecutive media sheets. This imposition is sometimes called simplex. SidesType.TWO_SIDED_LONG_EDGE imposes each consecutive pair of pages upon front and back sides of consecutive media sheets, such that the orientation of each pair of pages on the medium would be correct for the reader as if for binding on the long edge. This imposition is sometimes called duplex. SidesType.TWO_SIDED_SHORT_EDGE imposes each consecutive pair of pages upon front and back sides of consecutive media sheets, such that the orientation of each pair of pages on the medium would be correct for the reader as if for binding on the short edge. This imposition is sometimes called tumble. This attribute is updated to the value chosen by the user.

return
SidesType.ONE_SIDED, SidesType.TWO_SIDED_LONG_EDGE, or SidesType.TWO_SIDED_SHORT_EDGE.

        return sides;
    
public intgetToPage()
Returns, for jobs using these attributes, the last page (inclusive) to be printed, if a range of pages is to be printed. This attribute is updated to the value chosen by the user. An application should ignore this attribute on output, unless the return value of the getDefaultSelection method is DefaultSelectionType.RANGE. An application should honor the return value of getPageRanges over the return value of this method, if possible.

return
an integer greater than zero and greater than or equal to toPage and greater than or equal to minPage and less than or equal to maxPage.

        if (toPage != 0) {
	    return toPage;
	} else if (fromPage != 0) {
	    return fromPage;
	} else if (pageRanges != null) {
	    return prLast;
	} else {
	    return getMinPage();
	}
    
public inthashCode()
Returns a hash code value for this JobAttributes.

return
the hash code.

	int rest = ((copies + fromPage + maxPage + minPage + prFirst + prLast +
		     toPage) * 31) << 21;
	if (pageRanges != null) {
	    int sum = 0;
	    for (int i = 0; i < pageRanges.length; i++) {
	        sum += pageRanges[i][0] + pageRanges[i][1];
	    }
	    rest ^= (sum * 31) << 11;
	}
	if (fileName != null) {
	    rest ^= fileName.hashCode();
	}
	if (printer != null) {
	    rest ^= printer.hashCode();
	}
	return (defaultSelection.hashCode() << 6 ^
		destination.hashCode() << 5 ^
		dialog.hashCode() << 3 ^
		multipleDocumentHandling.hashCode() << 2 ^
		sides.hashCode() ^
		rest);
    
public voidset(java.awt.JobAttributes obj)
Sets all of the attributes of this JobAttributes to the same values as the attributes of obj.

param
obj the JobAttributes to copy

        copies = obj.copies;
	defaultSelection = obj.defaultSelection;
	destination = obj.destination;
	dialog = obj.dialog;
	fileName = obj.fileName;
	fromPage = obj.fromPage;
	maxPage = obj.maxPage;
	minPage = obj.minPage;
	multipleDocumentHandling = obj.multipleDocumentHandling;
	// okay because we never modify the contents of pageRanges
	pageRanges = obj.pageRanges;
	prFirst = obj.prFirst;
	prLast = obj.prLast;
	printer = obj.printer;
	sides = obj.sides;
	toPage = obj.toPage;
    
public voidsetCopies(int copies)
Specifies the number of copies the application should render for jobs using these attributes. Not specifying this attribute is equivalent to specifying 1.

param
copies an integer greater than 0
throws
IllegalArgumentException if copies is less than or equal to 0

        if (copies <= 0) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "copies");
	}
	this.copies = copies;
    
public voidsetCopiesToDefault()
Sets the number of copies the application should render for jobs using these attributes to the default. The default number of copies is 1.

        setCopies(1);
    
public voidsetDefaultSelection(java.awt.JobAttributes$DefaultSelectionType defaultSelection)
Specifies whether, for jobs using these attributes, the application should print all pages, the range specified by the return value of getPageRanges, or the current selection. Not specifying this attribute is equivalent to specifying DefaultSelectionType.ALL.

param
defaultSelection DefaultSelectionType.ALL, DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION.
throws
IllegalArgumentException if defaultSelection is null

        if (defaultSelection == null) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "defaultSelection");
	}
        this.defaultSelection = defaultSelection;
    
public voidsetDestination(java.awt.JobAttributes$DestinationType destination)
Specifies whether output will be to a printer or a file for jobs using these attributes. Not specifying this attribute is equivalent to specifying DesintationType.PRINTER.

param
destination DesintationType.FILE or DesintationType.PRINTER.
throws
IllegalArgumentException if destination is null.

        if (destination == null) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "destination");
	}
        this.destination = destination;
    
public voidsetDialog(java.awt.JobAttributes$DialogType dialog)
Specifies whether, for jobs using these attributes, the user should see a print dialog in which to modify the print settings, and which type of print dialog should be displayed. DialogType.COMMON denotes a cross- platform, pure Java print dialog. DialogType.NATIVE denotes the platform's native print dialog. If a platform does not support a native print dialog, the pure Java print dialog is displayed instead. DialogType.NONE specifies no print dialog (i.e., background printing). Not specifying this attribute is equivalent to specifying DialogType.NATIVE.

param
dialog DialogType.COMMON, DialogType.NATIVE, or DialogType.NONE.
throws
IllegalArgumentException if dialog is null.

        if (dialog == null) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "dialog");
	}
        this.dialog = dialog;
    
public voidsetFileName(java.lang.String fileName)
Specifies the file name for the output file for jobs using these attributes. Default is platform-dependent and implementation-defined.

param
fileName the possibly null file name.

        this.fileName = fileName;
    
public voidsetFromPage(int fromPage)
Specifies, for jobs using these attributes, the first page to be printed, if a range of pages is to be printed. If this attribute is not specified, then the values from the pageRanges attribute are used. If pageRanges and either or both of fromPage and toPage are specified, pageRanges takes precedence. Specifying none of pageRanges, fromPage, or toPage is equivalent to calling setPageRanges(new int[][] { new int[] { minPage } });

param
fromPage an integer greater than zero and less than or equal to toPage and greater than or equal to minPage and less than or equal to maxPage.
throws
IllegalArgumentException if one or more of the above conditions is violated.

        if (fromPage <= 0 ||
	    (toPage != 0 && fromPage > toPage) ||
	    fromPage < minPage ||
	    fromPage > maxPage) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "fromPage");
	}
	this.fromPage = fromPage;
    
public voidsetMaxPage(int maxPage)
Specifies the maximum value the user can specify as the last page to be printed for jobs using these attributes. Not specifying this attribute is equivalent to specifying Integer.MAX_VALUE.

param
maxPage an integer greater than zero and greater than or equal to minPage
throws
IllegalArgumentException if one or more of the above conditions is violated

        if (maxPage <= 0 || maxPage < minPage) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "maxPage");
	}
	this.maxPage = maxPage;
    
public voidsetMinPage(int minPage)
Specifies the minimum value the user can specify as the first page to be printed for jobs using these attributes. Not specifying this attribute is equivalent to specifying 1.

param
minPage an integer greater than zero and less than or equal to maxPage.
throws
IllegalArgumentException if one or more of the above conditions is violated.

        if (minPage <= 0 || minPage > maxPage) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "minPage");
	}
	this.minPage = minPage;
    
public voidsetMultipleDocumentHandling(java.awt.JobAttributes$MultipleDocumentHandlingType multipleDocumentHandling)
Specifies the handling of multiple copies, including collation, for jobs using these attributes. Not specifying this attribute is equivalent to specifying MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.

param
multipleDocumentHandling MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES or MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.
throws
IllegalArgumentException if multipleDocumentHandling is null.

        if (multipleDocumentHandling == null) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "multipleDocumentHandling");
	}
        this.multipleDocumentHandling = multipleDocumentHandling;
    
public voidsetMultipleDocumentHandlingToDefault()
Sets the handling of multiple copies, including collation, for jobs using these attributes to the default. The default handling is MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES.

        setMultipleDocumentHandling(
            MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
    
public voidsetPageRanges(int[][] pageRanges)
Specifies, for jobs using these attributes, the ranges of pages to be printed, if a range of pages is to be printed. All range numbers are inclusive. If this attribute is not specified, then the values from the fromPage and toPages attributes are used. If pageRanges and either or both of fromPage and toPage are specified, pageRanges takes precedence. Specifying none of pageRanges, fromPage, or toPage is equivalent to calling setPageRanges(new int[][] { new int[] { minPage, minPage } });

param
pageRanges an array of integer arrays of 2 elements. An array is interpreted as a range spanning all pages including and between the specified pages. Ranges must be in ascending order and must not overlap. Specified page numbers cannot be less than minPage nor greater than maxPage. For example: (new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 }, new int[] { 15, 19 } }), specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19. Note that (new int[][] { new int[] { 1, 1 }, new int[] { 1, 2 } }), is an invalid set of page ranges because the two ranges overlap.
throws
IllegalArgumentException if one or more of the above conditions is violated.

        String xcp = "Invalid value for attribute pageRanges";
	int first = 0;
        int last = 0;

	if (pageRanges == null) {
	    throw new IllegalArgumentException(xcp);
	}

        for (int i = 0; i < pageRanges.length; i++) {
	    if (pageRanges[i] == null ||
		pageRanges[i].length != 2 ||
		pageRanges[i][0] <= last ||
		pageRanges[i][1] < pageRanges[i][0]) {
	            throw new IllegalArgumentException(xcp);
	    }
	    last = pageRanges[i][1];
	    if (first == 0) {
	        first = pageRanges[i][0];
	    }
	}

	if (first < minPage || last > maxPage) {
	    throw new IllegalArgumentException(xcp);
	}

        // Store a copy because otherwise client code could circumvent the
        // the checks made above by holding a reference to the array and
	// modifying it after calling setPageRanges.
        int[][] copy = new int[pageRanges.length][2];
	for (int i = 0; i < pageRanges.length; i++) {
	    copy[i][0] = pageRanges[i][0];
	    copy[i][1] = pageRanges[i][1];
	}
	this.pageRanges = copy;
	this.prFirst = first;
	this.prLast = last;
    
public voidsetPrinter(java.lang.String printer)
Specifies the destination printer for jobs using these attributes. Default is platform-dependent and implementation-defined.

param
printer the possibly null printer name.

        this.printer = printer;
    
public voidsetSides(java.awt.JobAttributes$SidesType sides)
Specifies how consecutive pages should be imposed upon the sides of the print medium for jobs using these attributes. SidesType.ONE_SIDED imposes each consecutive page upon the same side of consecutive media sheets. This imposition is sometimes called simplex. SidesType.TWO_SIDED_LONG_EDGE imposes each consecutive pair of pages upon front and back sides of consecutive media sheets, such that the orientation of each pair of pages on the medium would be correct for the reader as if for binding on the long edge. This imposition is sometimes called duplex. SidesType.TWO_SIDED_SHORT_EDGE imposes each consecutive pair of pages upon front and back sides of consecutive media sheets, such that the orientation of each pair of pages on the medium would be correct for the reader as if for binding on the short edge. This imposition is sometimes called tumble. Not specifying this attribute is equivalent to specifying SidesType.ONE_SIDED.

param
sides SidesType.ONE_SIDED, SidesType.TWO_SIDED_LONG_EDGE, or SidesType.TWO_SIDED_SHORT_EDGE.
throws
IllegalArgumentException if sides is null.

        if (sides == null) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "sides");
	}
        this.sides = sides;
    
public voidsetSidesToDefault()
Sets how consecutive pages should be imposed upon the sides of the print medium for jobs using these attributes to the default. The default imposition is SidesType.ONE_SIDED.

        setSides(SidesType.ONE_SIDED);
    
public voidsetToPage(int toPage)
Specifies, for jobs using these attributes, the last page (inclusive) to be printed, if a range of pages is to be printed. If this attribute is not specified, then the values from the pageRanges attribute are used. If pageRanges and either or both of fromPage and toPage are specified, pageRanges takes precedence. Specifying none of pageRanges, fromPage, or toPage is equivalent to calling setPageRanges(new int[][] { new int[] { minPage } });

param
toPage an integer greater than zero and greater than or equal to fromPage and greater than or equal to minPage and less than or equal to maxPage.
throws
IllegalArgumentException if one or more of the above conditions is violated.

        if (toPage <= 0 ||
	    (fromPage != 0 && toPage < fromPage) ||
	    toPage < minPage ||
	    toPage > maxPage) {
	    throw new IllegalArgumentException("Invalid value for attribute "+
					       "toPage");
	}
	this.toPage = toPage;
    
public java.lang.StringtoString()
Returns a string representation of this JobAttributes.

return
the string representation.

        int[][] pageRanges = getPageRanges();
	String prStr = "[";
	boolean first = true;
	for (int i = 0; i < pageRanges.length; i++) {
	    if (first) {
	        first = false;
	    } else {
	        prStr += ",";
	    }
	    prStr += pageRanges[i][0] + ":" + pageRanges[i][1];
	}
	prStr += "]";

        return "copies=" + getCopies() + ",defaultSelection=" + 
	    getDefaultSelection() + ",destination=" + getDestination() +
	    ",dialog=" + getDialog() + ",fileName=" + getFileName() +
	    ",fromPage=" + getFromPage() + ",maxPage=" + getMaxPage() +
	    ",minPage=" + getMinPage() + ",multiple-document-handling=" +
	    getMultipleDocumentHandling() + ",page-ranges=" + prStr +
	    ",printer=" + getPrinter() + ",sides=" + getSides() + ",toPage=" +
	    getToPage();