The printing feature allows you to divide the diagram,
or a concrete section of it, into several surfaces of a given size,
to facilitate printing through standard browser printing features.
The printing functionality is performed by the PrintUtil class. You can instantiate this
class and customize it.
This code instantiates a new
PrintUtil
class
and customizes it:var myPrintUtil = new ibm_ilog.diagram.util.PrintUtil({ documentToPrint : other.document, getTargetSurfaceDiv: function(r,c) { return this.documentToPrint.getElementById("div" + r + "_" + c); }, postProcessing: function(r,c,surf,group){ dojo.style(surf.rawNode,{backgroundColor: '#888888'}); } });
The
getTargetSurfaceDiv
function
call is mandatory. It returns the div
where
the target surface is placed (with the given row and column). The postProcessing
is
an optional procedure that customizes the surface or group, if necessary.The
PrintUtil
class has two
public methods that apply surface transformations to multiple surfaces:printGraph
: separates the given graphboundingBox
intopagesWidth
for horizontal surfaces andpagesHeight
for vertical surfaces. The dimension of the surfaces is given by the width and height parameters. If no bounding parameter is given, the full graph is split.printViewport
: separates the given diagram viewport intopagesWidth
for horizontal surfaces andpagesHeight
for vertical surfaces. The dimension of the surfaces is given by the width and height parameters