com.levigo.jadice.printer
Class PrintJobConfiguration

java.lang.Object
  extended by com.levigo.jadice.printer.PrintJobConfiguration

public class PrintJobConfiguration
extends Object

Instances of this class accompanies and contains all configuration settings of a print process.


Nested Class Summary
static class PrintJobConfiguration.PrintMode
          Print modes: PrintJobConfiguration.PrintMode.AUTO Page structure will be analysed and to suitable print mode will be used PrintJobConfiguration.PrintMode.DEFAULT Forces default print mode, all elements will be rendered directly to the print graphics object PrintJobConfiguration.PrintMode.RASTERIZE_ALL All page elements will be rasterized to bitmap objects
 
Constructor Summary
PrintJobConfiguration()
          Constructs an instance of this class.
 
Method Summary
static PrintJobConfiguration create()
          Creates a new PrintJobConfiguration instance, prepared with the all default settings and configuration, as ready to use instance.
 int getCurrentPageIndex()
           
 com.levigo.jadice.document.filter.FilteredDocument getDocument()
          Deprecated.  
 LayerSelection getLayerSelectionToPrint()
           
 Collection<DocumentLayer> getLayersToPrint()
           
 int getNumbersOfPages()
           
 OutputReferenceBase getOutputReferenceBase()
          Simply returns the currently set OutputReferenceBase.
 PageFormat getPageFormat()
          Returns the currently set PageFormat object.
 String getPrintServiceName()
          Returns the print service name that was set.
 Sides getPrintSide()
          The current preselected print side.
 String getPrintTitle()
          Returns the print job title.
 int getPrintTitleMaxLength()
          Returns the max length of the print job title.
 RenderControlInventory getRenderControlInventory()
           
 EventList<Page> getSourcePages()
           
 boolean isAsynchronousPrinting()
           
 boolean isEnlargePageToPaper()
          Simply returns the current flag value.
 boolean isPageFormatValidationEnabled()
          Indicates whether the applied page format should be validated and modified against the chosen print service.
 boolean isRotateToFit()
          Simply returns the current flag value.
 boolean isShowPrintDialog()
          Indicates whether a print dialog should be shown.
 boolean isShrinkPageToPaper()
          Simply returns the current flag value.
 void setAsynchronousPrinting(boolean asynchronousPrinting)
          Defines whether print tasks will be started synchronously or asynchronously.
 void setCurrentPageIndex(int currentPageIndex)
          Use this method to set the current viewed Page's index.
 void setEnlargePageToPaper(boolean b)
          Simply sets a boolean flag.
 void setLayerSelectionToPrint(LayerSelection layerSelection)
           
 void setLayersToPrint(Collection<DocumentLayer> layers)
           
 void setPageFormat(PageFormat pf)
          Sets a PageFormat object that will be used as the media on which the printer will print.
 void setPageFormatValidationEnabled(boolean pageFormatValidationEnabled)
          Sets whether the applied page format should be validated and modified against the chosen print service.
 void setPrintServiceName(String printServiceName)
          Sets the given print service name.
 void setPrintSide(Sides side)
          Use this method to preselect the print side attribute.
 void setPrintTitle(String printTitle)
          Sets the print job title.
 void setPrintTitleMaxLength(int maxLength)
          Sets the max length of the print job title.
 void setReferenceBase(OutputReferenceBase referenceBase)
          Sets the reference base.
 void setRenderControlInventory(RenderControlInventory renderControlInventory)
           
 void setRotateToFit(boolean b)
          Simply sets a boolean flag.
 void setShowPrintDialog(boolean b)
          Sets a boolean flag whether a print dialog should be shown.
 void setShrinkPageToPaper(boolean b)
          Simply sets a boolean flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintJobConfiguration

public PrintJobConfiguration()
Constructs an instance of this class. This instance is not configured in any way, for its use it is essentially necessary to configure this instance manually. Therefore it is not advised to create an instance of this class by using this constructor.

To retrieve a ready-to-use PrintJobConfiguration instance prepared with default settings, defined by default values and/or user-defined configuration, it is recommended to use the factory method create() instead of using this constructor.

Method Detail

create

public static PrintJobConfiguration create()
Creates a new PrintJobConfiguration instance, prepared with the all default settings and configuration, as ready to use instance.

Returns:
PrintJobConfiguration

getDocument

@Deprecated
public com.levigo.jadice.document.filter.FilteredDocument getDocument()
Deprecated. 


getSourcePages

public EventList<Page> getSourcePages()

getNumbersOfPages

public int getNumbersOfPages()

getLayersToPrint

public Collection<DocumentLayer> getLayersToPrint()
Returns:
a list of layers to be printed on the base of the currently LayerSelection.

setLayersToPrint

public void setLayersToPrint(Collection<DocumentLayer> layers)

getLayerSelectionToPrint

public LayerSelection getLayerSelectionToPrint()
Returns:

setLayerSelectionToPrint

public void setLayerSelectionToPrint(LayerSelection layerSelection)

setShowPrintDialog

public void setShowPrintDialog(boolean b)
Sets a boolean flag whether a print dialog should be shown.

Parameters:
b - true if print dialog shall be shown, false if not.

isShowPrintDialog

public boolean isShowPrintDialog()
Indicates whether a print dialog should be shown.

Returns:
true if print dialog will be shown;
false if not.

isAsynchronousPrinting

public boolean isAsynchronousPrinting()
Returns:
true if print task will be started asynchronously, false if synchronously.

setAsynchronousPrinting

public void setAsynchronousPrinting(boolean asynchronousPrinting)
Defines whether print tasks will be started synchronously or asynchronously.

Parameters:
asynchronousPrinting - Set to true if the print task should be executed asynchronously or false if synchronously.

setPageFormat

public void setPageFormat(PageFormat pf)
Sets a PageFormat object that will be used as the media on which the printer will print. The PageFormat will be validated and if necessary corrected by printer drivers before start physical printing if the preferences indicates a validation and correction. Therefore see Jadice.properties or user-defined properties-file.

Simply sets an PageFormat object.

Parameters:
pf - the PageFormat object to be set.
Throws:
IllegalArgumentException - if argument is null.

getPageFormat

public PageFormat getPageFormat()
Returns the currently set PageFormat object. If it is not defined before a default page format will be returned.

Returns:
instance of PageFormat that is currently set.

setEnlargePageToPaper

public void setEnlargePageToPaper(boolean b)
Simply sets a boolean flag.

Parameters:
b - true if pages should be enlarged to fit into paper; false if not.

isEnlargePageToPaper

public boolean isEnlargePageToPaper()
Simply returns the current flag value.

Returns:
true if pages will be enlarged to fit into the paper;
false if it won't be enlarged.

setShrinkPageToPaper

public void setShrinkPageToPaper(boolean b)
Simply sets a boolean flag.

Parameters:
b - true if pages should be shrunk to fit into paper; false if not.

isShrinkPageToPaper

public boolean isShrinkPageToPaper()
Simply returns the current flag value.

Returns:
true if pages will be shrunk to fit into the paper;
false if it won't be shrunk.

setRotateToFit

public void setRotateToFit(boolean b)
Simply sets a boolean flag.

Parameters:
b - true if pages should be rotated to fit into paper; false if not.

isRotateToFit

public boolean isRotateToFit()
Simply returns the current flag value.

Returns:
true if pages will be rotated to fit into the paper;
false if it won't be rotated.

setReferenceBase

public void setReferenceBase(OutputReferenceBase referenceBase)
Sets the reference base.

Reference base defines whether the imageable area or the paper is used for the fitting of the content. Use the enumeration OutputReferenceBase to specify the reference base.

Parameters:
referenceBase -
See Also:
OutputReferenceBase

getOutputReferenceBase

public OutputReferenceBase getOutputReferenceBase()
Simply returns the currently set OutputReferenceBase.

Returns:
the currently set OutputReferenceBase.

getPrintTitle

public String getPrintTitle()
Returns the print job title.

Returns:
Print title

setPrintTitle

public void setPrintTitle(String printTitle)
Sets the print job title. This setting overrides the print job title generated by the printer class.

Parameters:
printTitle - Print title for print job, if the given print tilte is null, a empty string will be used as title

getPrintTitleMaxLength

public int getPrintTitleMaxLength()
Returns the max length of the print job title.

Returns:
the max length of the print job title. Negative values or zero indicates, that the print title will not be shortened if necessary.

setPrintTitleMaxLength

public void setPrintTitleMaxLength(int maxLength)
Sets the max length of the print job title.

Parameters:
maxLength - the max length of the print job title. Negative values or zero indicates, that the print title will not be shortened if necessary.

getRenderControlInventory

public RenderControlInventory getRenderControlInventory()

isPageFormatValidationEnabled

public boolean isPageFormatValidationEnabled()
Indicates whether the applied page format should be validated and modified against the chosen print service.

Returns:
validation enabled or not

setPageFormatValidationEnabled

public void setPageFormatValidationEnabled(boolean pageFormatValidationEnabled)
Sets whether the applied page format should be validated and modified against the chosen print service.

Parameters:
pageFormatValidationEnabled -

getPrintServiceName

public String getPrintServiceName()
Returns the print service name that was set.

Returns:
name of print service

setPrintServiceName

public void setPrintServiceName(String printServiceName)
Sets the given print service name. If parameter is null, the last print service name, provided by PrintManager.getLastPrintServiceName(), will be selected.
Hint: A check against available print services will not be performed.

Parameters:
printServiceName - the print service name or null.

setRenderControlInventory

public void setRenderControlInventory(RenderControlInventory renderControlInventory)

getPrintSide

public Sides getPrintSide()
The current preselected print side.

Returns:
One of the predefined Sides-objects or null if never set.

setPrintSide

public void setPrintSide(Sides side)
Use this method to preselect the print side attribute. Sides is part of Java's Printing Service. Our print model validates if the printer is able to take this option into account.

Note: If a printer or printer driver don't signal the truth about its abilities, this option will mostly be ignored while printing. In rare cases, this option will cause a print job to fail.

Parameters:
side - One of the predefined Sides-objects.

getCurrentPageIndex

public int getCurrentPageIndex()
Returns:
the current page index set via setCurrentPageIndex(int) or -1 if not set.

setCurrentPageIndex

public void setCurrentPageIndex(int currentPageIndex)
Use this method to set the current viewed Page's index.

If a current viewed Page' index is set a print dialog is able to provide the option to print only this page.

Note: The default implementation of direct printing (without UI and the ability to modify print options by an user) doesn't use this page index as an indicator to print the current page only. For backward compatibility, all source pages will be printed. If only the current page should be printed, please add only this page via getSourcePages().

Parameters:
currentPageIndex - current viewed Page's index.


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.