<!-- saved from url=(0026)http://www.naturaldocs.org -->
<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxPrintPreview"></a>mxPrintPreview</h1><divclass=CBody><p>Implements printing of a diagram across multiple pages. The following opens a print preview for an existing graph:</p><blockquote><preclass="prettyprint">var preview = new mxPrintPreview(graph);
preview.open();</pre></blockquote><p>Use <ahref="../util/mxUtils-js.html#mxUtils.getScaleForPageCount"class=LFunctionid=link44onMouseOver="ShowTip(event, 'tt41', 'link44')"onMouseOut="HideTip('tt41')">mxUtils.getScaleForPageCount</a> as follows in order to print the graph across a given number of pages:</p><blockquote><preclass="prettyprint">var pageCount = mxUtils.prompt('Enter page count', '1');
}</pre></blockquote><h4class=CHeading>Additional pages</h4><p>To add additional pages before and after the output, <ahref="#mxPrintPreview.getCoverPages"class=LFunctionid=link45onMouseOver="ShowTip(event, 'tt37', 'link45')"onMouseOut="HideTip('tt37')">getCoverPages</a> and <ahref="#mxPrintPreview.getAppendices"class=LFunctionid=link46onMouseOver="ShowTip(event, 'tt38', 'link46')"onMouseOut="HideTip('tt38')">getAppendices</a> can be used, respectively.</p><blockquote><preclass="prettyprint">var preview = new mxPrintPreview(graph, 1);
preview.open();</pre></blockquote><h4class=CHeading>CSS</h4><p>The CSS from the original page is not carried over to the print preview. To add CSS to the page, use the css argument in the <ahref="#mxPrintPreview.open"class=LFunctionid=link47onMouseOver="ShowTip(event, 'tt22', 'link47')"onMouseOut="HideTip('tt22')">open</a> function or override <ahref="#mxPrintPreview.writeHead"class=LFunctionid=link48onMouseOver="ShowTip(event, 'tt30', 'link48')"onMouseOut="HideTip('tt30')">writeHead</a> to add the respective link tags as follows:</p><blockquote><preclass="prettyprint">var writeHead = preview.writeHead;
};</pre></blockquote><h4class=CHeading>Padding</h4><p>To add a padding to the page in the preview (but not the print output), use the following code:</p><blockquote><preclass="prettyprint">preview.writeHead = function(doc)
};</pre></blockquote><h4class=CHeading>Headers</h4><p>Apart from setting the title argument in the mxPrintPreview constructor you can override <ahref="#mxPrintPreview.renderPage"class=LFunctionid=link49onMouseOver="ShowTip(event, 'tt32', 'link49')"onMouseOut="HideTip('tt32')">renderPage</a> as follows to add a header to any page:</p><blockquote><preclass="prettyprint">var oldRenderPage = mxPrintPreview.prototype.renderPage;
};</pre></blockquote><p>The pageNumber argument contains the number of the current page, starting at 1. To display a header on the first page only, check pageNumber and add a vertical offset in the constructor call for the height of the header.</p><h4class=CHeading>Page Format</h4><p>For landscape printing, use <mxConstants.PAGE_FORMAT_A4_LANDSCAPE> as the pageFormat in <ahref="../util/mxUtils-js.html#mxUtils.getScaleForPageCount"class=LFunctionid=link50onMouseOver="ShowTip(event, 'tt41', 'link50')"onMouseOut="HideTip('tt41')">mxUtils.getScaleForPageCount</a> and <ahref="#mxPrintPreview.mxPrintPreview"class=LFunctionid=link51onMouseOver="ShowTip(event, 'tt1', 'link51')"onMouseOut="HideTip('tt1')">mxPrintPreview</a>. Keep in mind that one can not set the defaults for the print dialog of the operating system from JavaScript so the user must manually choose a page format that matches this setting.</p><p>You can try passing the following CSS directive to <ahref="#mxPrintPreview.open"class=LFunctionid=link52onMouseOver="ShowTip(event, 'tt22', 'link52')"onMouseOut="HideTip('tt22')">open</a> to set the page format in the print dialog to landscape. However, this CSS directive seems to be ignored in most major browsers, including IE.</p><blockquote><preclass="prettyprint">@page {
}</pre></blockquote><p>Note that the print preview behaves differently in IE when used from the filesystem or via HTTP so printing should always be tested via HTTP.</p><p>If you are using a DOCTYPE in the source page you can override <getDoctype> and provide the same DOCTYPE for the print preview if required. Here is an example for IE8 standards mode.</p><blockquote><preclass="prettyprint">var preview = new mxPrintPreview(graph);
preview.open();</pre></blockquote><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxPrintPreview">mxPrintPreview</a></td><tdclass=SDescription>Implements printing of a diagram across multiple pages. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxPrintPreview.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxPrintPreview.mxPrintPreview"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">mxPrintPreview</a></td><tdclass=SDescription>Constructs a new print preview for the given parameters.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxPrintPreview.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxPrintPreview.graph"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">graph</a></td><tdclass=SDescription>Reference to the <ahref="mxGraph-js.html#mxGraph"class=LClassid=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">mxGraph</a> that should be previewed.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxPrintPreview.pageFormat"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">pageFormat</a></td><tdclass=SDescription>Holds the <ahref="../util/mxRectangle-js.html#mxRectangle"class=LClassid=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">mxRectangle</a> that defines the page format.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxPrintPreview.scale"id=link6onMouseOver="ShowTip(event, 'tt6', 'link6')"onMouseOut="HideTip('tt6')">scale</a></td><tdclass=SDescription>Holds the scale of the print preview.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxPrintPreview.border"id=link7onMouseOver="ShowTip(event, 'tt7', 'link7')"onMouseOut="HideTip('tt7')">border</a></td><tdclass=SDescription>The border inset around each side of every page in the preview. </td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxPrintPreview.marginTop"id=link8onMouseOver="ShowTip(event, 'tt8', 'link8')"onMouseOut="HideTip('tt8')">marginTop</a></td><tdclass=SDescription>The margin at the top of the page (number). </td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxPrintPreview.marginBottom"id=link9onMouseOver="ShowTip(event, 'tt9', 'link9')"onMouseOut="HideTip('tt9')">marginBottom</a></td><tdclass=SDescription>The margin at the bottom of the page (number). </td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxPrintPreview.x0"id=link10onMouseOver="ShowTip(event, 'tt10', 'link10')"onMouseOut="HideTip('tt10')">x0</a></td><tdclass=SDescription>Holds the horizontal offset of the output.</td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxPrintPreview.y0"id=link11onMouseOver="ShowTip(event, 'tt11', 'link11')"onMouseOut="HideTip('tt11')">y0</a></td><tdclass=SDescription>Holds the vertical offset of the output.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxPrintPreview.autoOrigin"id=link12onMouseOver="ShowTip(event, 'tt12', 'link12')"onMouseOut="HideTip('tt12')">autoOrigin</a></td><tdclass=SDescription>Specifies if the origin should be automatically computed based on the top, left corner of the actual diagram contents. </td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxPrintPreview.printOverlays"id=link13onMouseOver="ShowTip(event, 'tt13', 'link13')"onMouseOut="HideTip('tt13')">printOverlays</a></td><tdclass=SDescription>Specifies if overlays should be printed. </td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxPrintPreview.printControls"id=link14onMouseOver="ShowTip(event, 'tt14', 'link14')"onMouseOut="HideT
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.mxPrintPreview"></a>mxPrintPreview</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>function mxPrintPreview(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>scale,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>pageFormat,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>border,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>x0,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>y0,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>borderColor,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>title,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>pageSelector</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs a new print preview for the given parameters.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>graph</td><tdclass=CDLDescription><ahref="mxGraph-js.html#mxGraph"class=LClassid=link53onMouseOver="ShowTip(event, 'tt3', 'link53')"onMouseOut="HideTip('tt3')">mxGraph</a> to be previewed.</td></tr><tr><tdclass=CDLEntry>scale</td><tdclass=CDLDescription>Optional scale of the output. Default is 1 / <ahref="mxGraph-js.html#mxGraph.pageScale"class=LVariableid=link54onMouseOver="ShowTip(event, 'tt42', 'link54')"onMouseOut="HideTip('tt42')">mxGraph.pageScale</a>.</td></tr><tr><tdclass=CDLEntry>border</td><tdclass=CDLDescription>Border in pixels along each side of every page. Note that the actual print function in the browser will add another border for printing.</td></tr><tr><tdclass=CDLEntry>pageFormat</td><tdclass=CDLDescription><ahref="../util/mxRectangle-js.html#mxRectangle"class=LClassid=link55onMouseOver="ShowTip(event, 'tt5', 'link55')"onMouseOut="HideTip('tt5')">mxRectangle</a> that specifies the page format (in pixels). This should match the page format of the printer. Default uses the <ahref="mxGraph-js.html#mxGraph.pageFormat"class=LVariableid=link56onMouseOver="ShowTip(event, 'tt43', 'link56')"onMouseOut="HideTip('tt43')">mxGraph.pageFormat</a> of the given graph.</td></tr><tr><tdclass=CDLEntry>x0</td><tdclass=CDLDescription>Optional left offset of the output. Default is 0.</td></tr><tr><tdclass=CDLEntry>y0</td><tdclass=CDLDescription>Optional top offset of the output. Default is 0.</td></tr><tr><tdclass=CDLEntry>borderColor</td><tdclass=CDLDescription>Optional color of the page border. Default is no border. Note that a border is sometimes useful to highlight the printed page border in the print preview of the browser.</td></tr><tr><tdclass=CDLEntry>title</td><tdclass=CDLDescription>Optional string that is used for the window title. Default is ‘Printer-friendly version’.</td></tr><tr><tdclass=CDLEntry>pageSelector</td><tdclass=CDLDescription>Optional boolean that specifies if the page selector should appear in the window with the print preview. Default is true.</td></tr></table></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.graph"></a>graph</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.graph</td></tr></table></blockquote><p>Reference to the <ahref="mxGraph-js.html#mxGraph"class=LClassid=link57onMouseOver="ShowTip(event, 'tt3', 'link57')"onMouseOut="HideTip('tt3')">mxGraph</a> that should be previewed.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.pageFormat"></a>pageFormat</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.pageFormat</td></tr></table></blockquote><p>Holds the <ahref="../util/mxRectangle-js.html#mxRectangle"class=LClassid=link58onMouseOver="ShowTip(event, 'tt5', 'link58')"onMouseOut="HideTip('tt5')">mxRectangle</a> that defines the page format.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.scale"></a>scale</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.scale</td></tr></table></blockquote><p>Holds the scale of the print preview.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.border"></a>border</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.border</td></tr></table></blockquote><p>The border inset around each side of every page in the preview. This is set to 0 if autoOrigin is false.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.marginTop"></a>marginTop</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.marginTop</td></tr></table></blockquote><p>The margin at the top of the page (number). Default is 0.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.marginBottom"></a>marginBottom</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.marginBottom</td></tr></table></blockquote><p>The margin at the bottom of the page (number). Default is 0.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.x0"></a>x0</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.x0</td></tr></table></blockquote><p>Holds the horizontal offset of the output.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.y0"></a>y0</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.y0</td></tr></table></blockquote><p>Holds the vertical offset of the output.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.autoOrigin"></a>autoOrigin</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.autoOrigin</td></tr></table></blockquote><p>Specifies if the origin should be automatically computed based on the top, left corner of the actual diagram contents. The required offset will be added to <ahref="#mxPrintPreview.x0"class=LVariableid=link59onMouseOver="ShowTip(event, 'tt10', 'link59')"onMouseOut="HideTip('tt10')">x0</a> and <ahref="#mxPrintPreview.y0"class=LVariableid=link60onMouseOver="ShowTip(event, 'tt11', 'link60')"onMouseOut="HideTip('tt11')">y0</a> in <ahref="#mxPrintPreview.open"class=LFunctionid=link61onMouseOver="ShowTip(event, 'tt22', 'link61')"onMouseOut="HideTip('tt22')">open</a>. Default is true.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.printOverlays"></a>printOverlays</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.printOverlays</td></tr></table></blockquote><p>Specifies if overlays should be printed. Default is false.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.printControls"></a>printControls</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.printControls</td></tr></table></blockquote><p>Specifies if controls (such as folding icons) should be printed. Default is false.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.printBackgroundImage"></a>printBackgroundImage</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.printBackgroundImage</td></tr></table></blockquote><p>Specifies if the background image should be printed. Default is false.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.backgroundColor"></a>backgroundColor</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.backgroundColor</td></tr></table></blockquote><p>Holds the color value for the page background color. Default is #ffffff.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.borderColor"></a>borderColor</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.borderColor</td></tr></table></blockquote><p>Holds the color value for the page border.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.title"></a>title</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.title</td></tr></table></blockquote><p>Holds the title of the preview window.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.pageSelector"></a>pageSelector</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.pageSelector</td></tr></table></blockquote><p>Boolean that specifies if the page selector should be displayed. Default is true.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.wnd"></a>wnd</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.wnd</td></tr></table></blockquote><p>Reference to the preview window.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.targetWindow"></a>targetWindow</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.targetWindow</td></tr></table></blockquote><p>Assign any window here to redirect the rendering in <ahref="#mxPrintPreview.open"class=LFunctionid=link62onMouseOver="ShowTip(event, 'tt22', 'link62')"onMouseOut="HideTip('tt22')">open</a>.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.pageCount"></a>pageCount</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.pageCount</td></tr></table></blockquote><p>Holds the actual number of pages in the preview.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.clipping"></a>clipping</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.clipping</td></tr></table></blockquote><p>Specifies is clipping should be used to avoid creating too many cell states in large diagrams. The bounding box of the cells in the original diagram is used if this is enabled. Default is true.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.getDocType"></a>getDocType</h3><divclass=CBody><p>Returns the string that should go before the HTML tag in the print preview page. This implementation returns an X-UA meta tag for IE5 in quirks mode, IE8 in IE8 standards mode and edge in IE9 standards mode.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.appendGraph"></a>appendGraph</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.appendGraph = function(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>scale,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>x0,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>y0,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>forcePageBreaks,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>keepOpen</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds the given graph to the existing print preview.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>css</td><tdclass=CDLDescription>Optional CSS string to be used in the head section.</td></tr><tr><tdclass=CDLEntry>targetWindow</td><tdclass=CDLDescription>Optional window that should be used for rendering. If this is specified then no HEAD tag, CSS and BODY tag will be written.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.open"></a>open</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.open = function(</td><tdclass="PParameter prettyprint "nowrap>css,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>targetWindow,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>forcePageBreaks,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>keepOpen</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Shows the print preview window. The window is created here if it does not exist.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>css</td><tdclass=CDLDescription>Optional CSS string to be used in the head section.</td></tr><tr><tdclass=CDLEntry>targetWindow</td><tdclass=CDLDescription>Optional window that should be used for rendering. If this is specified then no HEAD tag, CSS and BODY tag will be written.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.addPageBreak"></a>addPageBreak</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.addPageBreak = function(</td><tdclass="PParameter prettyprint "nowrap>doc</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds a page break to the given document.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.closeDocument"></a>closeDocument</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.closeDocument = function()</td></tr></table></blockquote><p>Writes the closing tags for body and page after calling <ahref="#mxPrintPreview.writePostfix"class=LFunctionid=link64onMouseOver="ShowTip(event, 'tt29', 'link64')"onMouseOut="HideTip('tt29')">writePostfix</a>.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.writeHead"></a>writeHead</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.writeHead = function(</td><tdclass="PParameter prettyprint "nowrap>doc,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>css</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes the HEAD section into the given document, without the opening and closing HEAD tags.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.writePostfix"></a>writePostfix</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.writePostfix = function(</td><tdclass="PParameter prettyprint "nowrap>doc</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Called before closing the body of the page. This implementation is empty.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.renderPage"></a>renderPage</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.renderPage = function(</td><tdclass="PParameter prettyprint "nowrap>w,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>h,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>dx,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>dy,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>content,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>pageNumber</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Creates a DIV that prints a single page of the given graph using the given scale and returns the DIV that represents the page.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>w</td><tdclass=CDLDescription>Width of the page in pixels.</td></tr><tr><tdclass=CDLEntry>h</td><tdclass=CDLDescription>Height of the page in pixels.</td></tr><tr><tdclass=CDLEntry>dx</td><tdclass=CDLDescription>Optional horizontal page offset in pixels (used internally).</td></tr><tr><tdclass=CDLEntry>dy</td><tdclass=CDLDescription>Optional vertical page offset in pixels (used internally).</td></tr><tr><tdclass=CDLEntry>content</td><tdclass=CDLDescription>Callback that adds the HTML content to the inner div of a page. Takes the inner div as the argument.</td></tr><tr><tdclass=CDLEntry>pageNumber</td><tdclass=CDLDescription>Integer representing the page number.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.getRoot"></a>getRoot</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.getRoot = function()</td></tr></table></blockquote><p>Returns the root cell for painting the graph.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.addGraphFragment"></a>addGraphFragment</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.addGraphFragment = function(</td><tdclass="PParameter prettyprint "nowrap>dx,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>dy,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>scale,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>pageNumber,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>div,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>clip</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds a graph fragment to the given div.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>dx</td><tdclass=CDLDescription>Horizontal translation for the diagram.</td></tr><tr><tdclass=CDLEntry>dy</td><tdclass=CDLDescription>Vertical translation for the diagram.</td></tr><tr><tdclass=CDLEntry>scale</td><tdclass=CDLDescription>Scale for the diagram.</td></tr><tr><tdclass=CDLEntry>pageNumber</td><tdclass=CDLDescription>Number of the page to be rendered.</td></tr><tr><tdclass=CDLEntry>div</td><tdclass=CDLDescription>Div that contains the output.</td></tr><tr><tdclass=CDLEntry>clip</td><tdclass=CDLDescription>Contains the clipping rectangle as an <ahref="../util/mxRectangle-js.html#mxRectangle"class=LClassid=link65onMouseOver="ShowTip(event, 'tt5', 'link65')"onMouseOut="HideTip('tt5')">mxRectangle</a>.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.getLinkForCellState"></a>getLinkForCellState</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.getLinkForCellState = function(</td><tdclass="PParameter prettyprint "nowrap>state</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the link for the given cell state. This returns null.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.insertBackgroundImage"></a>insertBackgroundImage</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.insertBackgroundImage = function(</td><tdclass="PParameter prettyprint "nowrap>div,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>dx,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>dy</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Inserts the background image into the given div.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.getCoverPages"></a>getCoverPages</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.getCoverPages = function()</td></tr></table></blockquote><p>Returns the pages to be added before the print output. This returns null.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.getAppendices"></a>getAppendices</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.getAppendices = function()</td></tr></table></blockquote><p>Returns the pages to be added after the print output. This returns null.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxPrintPreview.print"></a>print</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>mxPrintPreview.prototype.print = function(</td><tdclass="PParameter prettyprint "nowrap>css</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Opens the print preview and shows the print dialog.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>css</td><tdclass=CDLDescription>Optional CSS string to be used in the head section.</td></tr></table></div></div></div>
<divclass=CToolTipid="tt1"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>function mxPrintPreview(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>scale,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>pageFormat,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>border,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>x0,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>y0,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>borderColor,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>title,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>pageSelector</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Constructs a new print preview for the given parameters.</div></div><divclass=CToolTipid="tt2"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.graph</td></tr></table></blockquote>Reference to the mxGraph that should be previewed.</div></div><divclass=CToolTipid="tt3"><divclass=CClass>Extends mxEventSource to implement a graph component for the browser. </div></div><divclass=CToolTipid="tt4"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.pageFormat</td></tr></table></blockquote>Holds the mxRectangle that defines the page format.</div></div><divclass=CToolTipid="tt5"><divclass=CClass>Extends mxPoint to implement a 2-dimensional rectangle with double precision coordinates.</div></div><divclass=CToolTipid="tt6"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.scale</td></tr></table></blockquote>Holds the scale of the print preview.</div></div><divclass=CToolTipid="tt7"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.border</td></tr></table></blockquote>The border inset around each side of every page in the preview. </div></div><divclass=CToolTipid="tt8"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.marginTop</td></tr></table></blockquote>The margin at the top of the page (number). </div></div><divclass=CToolTipid="tt9"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.marginBottom</td></tr></table></blockquote>The margin at the bottom of the page (number). </div></div><divclass=CToolTipid="tt10"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.x0</td></tr></table></blockquote>Holds the horizontal offset of the output.</div></div><divclass=CToolTipid="tt11"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.y0</td></tr></table></blockquote>Holds the vertical offset of the output.</div></div><divclass=CToolTipid="tt12"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.autoOrigin</td></tr></table></blockquote>Specifies if the origin should be automatically computed based on the top, left corner of the actual diagram contents. </div></div><divclass=CToolTipid="tt13"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">mxPrintPreview.prototype.printOverlays</td></tr></