com.numdata.printer
Class PrinterSettings

java.lang.Object
  extended by com.numdata.printer.PrinterSettings

public class PrinterSettings
extends Object

This class is used for printer settings.

Author:
G.B.M. Rupert

Nested Class Summary
static class PrinterSettings.Method
          Printing method.
static class PrinterSettings.PageOrientation
          Page orientation strings.
 
Field Summary
static String HOSTNAME
          Constant to identify 'hostname' setting.
static String IMAGEABLE_HEIGHT
          Constant to identify 'imageable height' setting.
static String IMAGEABLE_WIDTH
          Constant to identify 'imageable width' setting.
static String IMAGEABLE_X
          Constant to identify 'imageable x' setting.
static String IMAGEABLE_Y
          Constant to identify 'imageable y' setting.
static int LPD_PORT
          The default LPD port number.
static String METHOD
          Constant to identify 'method' setting.
static double MILLIMETER_IN_POINTS
          A millimeter expressed in points (PostScript).
static String NETWORK_PORT
          Constant to identify 'networkPort' setting.
static String PAGE_HEIGHT
          Constant to identify 'page height' setting.
static String PAGE_ORIENTATION
          Constant to identify 'page orientation' setting.
static String PAGE_WIDTH
          Constant to identify 'page width' setting.
static String QUEUE_NAME
          Constant to identify 'queueName' setting.
static String RESOLUTION
          Constant to identify 'resolution' setting.
 
Constructor Summary
PrinterSettings()
          Create default printer settings.
 
Method Summary
 NestedProperties exportSettings()
          Export settings.
 String getHostname()
           
 double getImageablePageHeight()
          Gets the height of the imageable area of the printer's default page format, in millimeters.
 double getImageablePageWidth()
          Gets the width of the imageable area of the printer's default page format, in millimeters.
 double getImageableX()
          Gets the X-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.
 double getImageableY()
          Gets the Y-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.
 Insets2D getMargins()
          Get print margins.
 PrinterSettings.Method getMethod()
           
 int getNetworkPort()
           
 PageFormat getPageFormat()
           
 double getPageHeight()
          Gets the height of the printer's default page format, in millimeters.
 PrinterSettings.PageOrientation getPageOrientation()
          Get page orientation.
 double getPageWidth()
          Gets the width of the printer's default page format, in millimeters.
 String getQueueName()
           
 double getResolution()
           
 void importSettings(Properties settings)
          Import settings from Properties.
 void setHostname(String hostname)
           
 void setImageableArea(double x, double y, double width, double height)
          Sets the imageable area of the printer's default page format.
 void setImageablePageHeight(double height)
          Sets the height of the imageable area of the printer's default page format, in millimeters.
 void setImageablePageWidth(double width)
          Sets the width of the imageable area of the printer's default page format, in millimeters.
 void setImageableX(double x)
          Sets the X-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.
 void setImageableY(double y)
          Sets the Y-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.
 void setMargins(Insets2D margins)
          Get print margins.
 void setMediaSize(MediaSize mediaSize)
          Convenience method to set media size while maintaining margins (the imageable area is adjusted).
 void setMethod(PrinterSettings.Method method)
           
 void setNetworkPort(int networkPort)
           
 void setPageFormat(PageFormat pageFormat)
           
 void setPageHeight(double height)
          Sets the height of the printer's default page format, in millimeters.
 void setPageOrientation(PrinterSettings.PageOrientation pageOrientation)
          Set page orientation.
 void setPageSize(double width, double height)
          Sets the width of the printer's default page format.
 void setPageWidth(double width)
          Sets the width of the printer's default page format, in millimeters.
 void setQueueName(String queueName)
           
 void setResolution(double resolution)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD

public static final String METHOD
Constant to identify 'method' setting.

See Also:
Constant Field Values

HOSTNAME

public static final String HOSTNAME
Constant to identify 'hostname' setting.

See Also:
Constant Field Values

NETWORK_PORT

public static final String NETWORK_PORT
Constant to identify 'networkPort' setting.

See Also:
Constant Field Values

QUEUE_NAME

public static final String QUEUE_NAME
Constant to identify 'queueName' setting.

See Also:
Constant Field Values

RESOLUTION

public static final String RESOLUTION
Constant to identify 'resolution' setting.

See Also:
Constant Field Values

PAGE_WIDTH

public static final String PAGE_WIDTH
Constant to identify 'page width' setting.

See Also:
Constant Field Values

PAGE_HEIGHT

public static final String PAGE_HEIGHT
Constant to identify 'page height' setting.

See Also:
Constant Field Values

PAGE_ORIENTATION

public static final String PAGE_ORIENTATION
Constant to identify 'page orientation' setting.

See Also:
Constant Field Values

IMAGEABLE_X

public static final String IMAGEABLE_X
Constant to identify 'imageable x' setting.

See Also:
Constant Field Values

IMAGEABLE_Y

public static final String IMAGEABLE_Y
Constant to identify 'imageable y' setting.

See Also:
Constant Field Values

IMAGEABLE_WIDTH

public static final String IMAGEABLE_WIDTH
Constant to identify 'imageable width' setting.

See Also:
Constant Field Values

IMAGEABLE_HEIGHT

public static final String IMAGEABLE_HEIGHT
Constant to identify 'imageable height' setting.

See Also:
Constant Field Values

LPD_PORT

public static final int LPD_PORT
The default LPD port number.

See Also:
Constant Field Values

MILLIMETER_IN_POINTS

public static final double MILLIMETER_IN_POINTS
A millimeter expressed in points (PostScript). A PostScript point is defined as 1/72 of an inch.

See Also:
Constant Field Values
Constructor Detail

PrinterSettings

public PrinterSettings()
Create default printer settings.

Method Detail

importSettings

public void importSettings(Properties settings)
Import settings from Properties.

Parameters:
settings - Settings to import.

exportSettings

public NestedProperties exportSettings()
Export settings.

Returns:
Settings.

getMethod

@NotNull
public PrinterSettings.Method getMethod()

setMethod

public void setMethod(@NotNull
                      PrinterSettings.Method method)

getHostname

@Nullable
public String getHostname()

setHostname

public void setHostname(@Nullable
                        String hostname)

getNetworkPort

public int getNetworkPort()

setNetworkPort

public void setNetworkPort(int networkPort)

getQueueName

public String getQueueName()

setQueueName

public void setQueueName(String queueName)

getResolution

public double getResolution()

setResolution

public void setResolution(double resolution)

getPageOrientation

@NotNull
public PrinterSettings.PageOrientation getPageOrientation()
Get page orientation.

Returns:
Page orientation (PageFormat.LANDSCAPE, PageFormat.PORTRAIT, or PageFormat.REVERSE_LANDSCAPE).

setPageOrientation

public void setPageOrientation(@NotNull
                               PrinterSettings.PageOrientation pageOrientation)
Set page orientation.

Parameters:
pageOrientation - Page orientation to set.
Throws:
IllegalArgumentException - if an unknown orientation was requested

getPageWidth

public double getPageWidth()
Gets the width of the printer's default page format, in millimeters.

Returns:
Width of the printer's default page format, in millimeters.

setPageWidth

public void setPageWidth(double width)
Sets the width of the printer's default page format, in millimeters.

Parameters:
width - Width to be set, in millimeters, in millimeters.

getPageHeight

public double getPageHeight()
Gets the height of the printer's default page format, in millimeters.

Returns:
Height of the printer's default page format, in millimeters.

setPageHeight

public void setPageHeight(double height)
Sets the height of the printer's default page format, in millimeters.

Parameters:
height - Height to be set, in millimeters, in millimeters.

setPageSize

public void setPageSize(double width,
                        double height)
Sets the width of the printer's default page format.

Parameters:
width - Width to be set, in millimeters.
height - Height to be set, in millimeters.

getImageableX

public double getImageableX()
Gets the X-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.

Returns:
X-coordinate of top-left corner of imageable area, in millimeters.

setImageableX

public void setImageableX(double x)
Sets the X-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.

Parameters:
x - X-coordinate of top-left corner of imageable area, in millimeters.

getImageableY

public double getImageableY()
Gets the Y-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.

Returns:
Y-coordinate of top-left corner of imageable area, in millimeters.

setImageableY

public void setImageableY(double y)
Sets the Y-coordinate of the top-left corner of the imageable area of the printer's default page format, in millimeters.

Parameters:
y - Y-coordinate of top-left corner of imageable area, in millimeters.

getImageablePageWidth

public double getImageablePageWidth()
Gets the width of the imageable area of the printer's default page format, in millimeters.

Returns:
Width of the imageable area, in millimeters.

setImageablePageWidth

public void setImageablePageWidth(double width)
Sets the width of the imageable area of the printer's default page format, in millimeters.

Parameters:
width - Width of the imageable area, in millimeters.

getImageablePageHeight

public double getImageablePageHeight()
Gets the height of the imageable area of the printer's default page format, in millimeters.

Returns:
Height of the imageable area, in millimeters.

setImageablePageHeight

public void setImageablePageHeight(double height)
Sets the height of the imageable area of the printer's default page format, in millimeters.

Parameters:
height - Height of the imageable area, in millimeters.

setImageableArea

public void setImageableArea(double x,
                             double y,
                             double width,
                             double height)
Sets the imageable area of the printer's default page format.

Parameters:
x - X-coordinate of the top-left corner of the imageable area, in millimeters.
y - Y-coordinate of the top-left corner of the imageable area, in millimeters.
width - Width of the imageable area, in millimeters.
height - Height of the imageable area, in millimeters.

getMargins

public Insets2D getMargins()
Get print margins.

Returns:
Print margins (in millimeters).

setMargins

public void setMargins(Insets2D margins)
Get print margins.

Parameters:
margins - Print margins (in millimeters).

setMediaSize

public void setMediaSize(@NotNull
                         MediaSize mediaSize)
Convenience method to set media size while maintaining margins (the imageable area is adjusted).

Parameters:
mediaSize - Media size to set.

getPageFormat

@Nullable
public PageFormat getPageFormat()

setPageFormat

public void setPageFormat(@Nullable
                          PageFormat pageFormat)


Copyright © 2017 Numdata BV. All rights reserved.