Class DocumentPrintNode
- java.lang.Object
-
- com.levigo.jadice.server.internal.NodeInternal
-
- com.levigo.jadice.server.Node
-
- com.levigo.jadice.server.documentplatform.DocumentPrintNode
-
public class DocumentPrintNode extends Node
ThisNode
is used to print out documents via the Java™ Print Service API.As the functionality of this node is based on the jadice document platform only those type of documents are supported that the jadice document platform can load. In any other case the action specified via
setUnhandledFormatAction(UnhandledFormatAction)
and an event with MessageIDJS.DOCP-UNKNOWN_DOCUMENT_FORMAT
will be fired.As this node is a data sink it must not have a successor.
Its worker respects
PageCountLimit
s.- Since:
- jadice server 4.3.1.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DocumentPrintNode.OutputReferenceBase
The reference base specifies what is used as the basic area of the printed output on the paper as well as how scaling/fitting/rotation- optimization is performed.-
Nested classes/interfaces inherited from class com.levigo.jadice.server.Node
Node.Cardinality
-
-
Constructor Summary
Constructors Constructor Description DocumentPrintNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node.Cardinality
getOutputCardinality()
Return the output cardinality of this node, i.e.PageFormat
getPageFormat()
PrintRequestAttributeSet
getPrintRequestAttributeSet()
String
getPrintServiceName()
DocumentPrintNode.OutputReferenceBase
getReferenceBase()
JadiceDocumentInfoNode.UnhandledFormatAction
getUnhandledFormatAction()
String
getWorkerClassName()
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name.boolean
isEnlargePageToPaper()
boolean
isOptimizeRotation()
boolean
isShrinkPageToPaper()
void
setEnlargePageToPaper(boolean enlargePageToPaper)
Set if the the page shall be enlarged to fit onto the paper.void
setOptimizeRotation(boolean optimizeRotation)
If this flag is set the rotation of the pages will be optimized.void
setPageFormat(PageFormat pageFormat)
Sets aPageFormat
object that will be used as the media on which the printer will print.void
setPrintRequestAttributeSet(PrintRequestAttributeSet printAttributes)
Set print request attributes, e.g.void
setPrintServiceName(String printServiceName)
Set the name of the printer service that the server will use, i.e.void
setReferenceBase(DocumentPrintNode.OutputReferenceBase referenceBase)
Sets the reference base.void
setShrinkPageToPaper(boolean shrinkPageToPaper)
Set if the the page shall be shrinked to fit onto the paper completely.void
setUnhandledFormatAction(JadiceDocumentInfoNode.UnhandledFormatAction action)
Set the action to take when a given document has an unknown or unsupported format.protected void
validateConfiguration()
-
Methods inherited from class com.levigo.jadice.server.Node
addTransportReceiver, appendSuccessor, apply, equals, getInputCardinality, getJob, getPredecessors, getSubsidiaryNodes, getSuccessors, getTransportSender, getUUID, hashCode, initialize, prependPredecessor, remove
-
-
-
-
Method Detail
-
setPrintServiceName
public void setPrintServiceName(String printServiceName)
Set the name of the printer service that the server will use, i.e. printer name. This service must be available on the server side. Otherwise the job will fail. Default value:null
, uses the default print service- Parameters:
printServiceName
- name of the print service to use- See Also:
PrintServiceLookup
-
getPrintServiceName
public String getPrintServiceName()
- Returns:
- Name of the print service to use.
-
setPrintRequestAttributeSet
public void setPrintRequestAttributeSet(PrintRequestAttributeSet printAttributes)
Set print request attributes, e.g. number of copies, duplex mode.Default value: empty set. This property must not be null.
- Parameters:
printAttributes
- attributes the print service shall use.- See Also:
PrintRequestAttributeSet
,PrintRequestAttribute
-
getPrintRequestAttributeSet
public PrintRequestAttributeSet getPrintRequestAttributeSet()
- Returns:
- Print request attributes the print service shall use
-
setPageFormat
public void setPageFormat(PageFormat pageFormat)
Sets aPageFormat
object that will be used as the media on which the printer will print. ThePageFormat
will be validated and if necessary corrected by printer drivers before start physical printing if the preferences indicates a validation and correction.As
PageFormat
is notSerializable
, a wrapper class must be used here.- Parameters:
pageFormat
- thePageFormat
object to be set.
-
getPageFormat
public PageFormat getPageFormat()
- Returns:
- the
PageFormat
that the printer will use.
-
setEnlargePageToPaper
public void setEnlargePageToPaper(boolean enlargePageToPaper)
Set if the the page shall be enlarged to fit onto the paper. (Default value:false
- Parameters:
enlargePageToPaper
- pages will be enlarged to page size ifftrue
-
isEnlargePageToPaper
public boolean isEnlargePageToPaper()
- Returns:
- whether or not to enlarge pages to fit onto the paper.
-
setShrinkPageToPaper
public void setShrinkPageToPaper(boolean shrinkPageToPaper)
Set if the the page shall be shrinked to fit onto the paper completely. (Default value:true
- Parameters:
shrinkPageToPaper
- pages will be shrinked to page size ifftrue
-
isShrinkPageToPaper
public boolean isShrinkPageToPaper()
- Returns:
- whether or not to shrink pages to fit onto the paper.
-
setOptimizeRotation
public void setOptimizeRotation(boolean optimizeRotation)
If this flag is set the rotation of the pages will be optimized. Optimization means that landscape pages will be rotated to that the fit better onto portrait pages and vice versa.- Parameters:
optimizeRotation
- pages can be rotated iff set totrue
-
isOptimizeRotation
public boolean isOptimizeRotation()
- Returns:
- whether or not pages can be rotated.
-
setReferenceBase
public void setReferenceBase(DocumentPrintNode.OutputReferenceBase referenceBase)
Sets the reference base. Reference base defines whether the imageable area or the paper is used for the fitting of the content.Default value:
DocumentPrintNode.OutputReferenceBase.PAGEFORMAT
. This property must not be null.- Parameters:
referenceBase
- the reference base to use- See Also:
DocumentPrintNode.OutputReferenceBase
-
getReferenceBase
public DocumentPrintNode.OutputReferenceBase getReferenceBase()
- Returns:
- the output reference base
- See Also:
DocumentPrintNode.OutputReferenceBase
-
setUnhandledFormatAction
public void setUnhandledFormatAction(JadiceDocumentInfoNode.UnhandledFormatAction action)
Set the action to take when a given document has an unknown or unsupported format.Caveat: If set to
JadiceDocumentInfoNode.UnhandledFormatAction.WARN
the document will be printed by hook or by crook, even if it might be interpreted as plain text ASCII document which will produce lots of wasted pages.
This value must not benull
.- Parameters:
action
- action to take. Default:JadiceDocumentInfoNode.UnhandledFormatAction.ABORT
-
getUnhandledFormatAction
public JadiceDocumentInfoNode.UnhandledFormatAction getUnhandledFormatAction()
- Returns:
- The action to take when a given document has an unknown or unsupported format.
-
getWorkerClassName
public String getWorkerClassName()
Description copied from class:Node
Return the node's associatedcom.levigo.jadice.server.core.NodeWorker
full qualified class's name. By default, the worker class name is- The same as the node name with the trailing "Node" replaced by "Worker" if the node name ends in "Node"
- The node class name with an appended "Worker" otherwise.
This behavior can be overridden in concrete subclasses.
- Overrides:
getWorkerClassName
in classNode
- Returns:
- the full qualified class name of the worker of this node.
-
validateConfiguration
protected void validateConfiguration() throws ConfigurationException
- Overrides:
validateConfiguration
in classNode
- Throws:
ConfigurationException
-
getOutputCardinality
public Node.Cardinality getOutputCardinality()
Description copied from class:Node
Return the output cardinality of this node, i.e. how many bundles (not streams!) it expects to produce. By default, nodes are "pipe-style", i.e. one input, one output.- Overrides:
getOutputCardinality
in classNode
- Returns:
- output cardinality
-
-