';
+ html += graph.container.innerHTML;
+ html += '
';
+
+ doc.writeln(html);
+ doc.close();
+ } else {
+ doc.writeln('');
+
+ var base = document.getElementsByTagName('base');
+
+ for (var i = 0; i < base.length; i++) {
+ doc.writeln(mxUtils.getOuterHtml(base[i]));
+ }
+
+ var links = document.getElementsByTagName('link');
+
+ for (var i = 0; i < links.length; i++) {
+ doc.writeln(mxUtils.getOuterHtml(links[i]));
+ }
+
+ var styles = document.getElementsByTagName('style');
+
+ for (var i = 0; i < styles.length; i++) {
+ doc.writeln(mxUtils.getOuterHtml(styles[i]));
+ }
+
+ doc.writeln('');
+ doc.close();
+
+ var outer = doc.createElement('div');
+ outer.position = 'absolute';
+ outer.overflow = 'hidden';
+ outer.style.width = w + 'px';
+ outer.style.height = h + 'px';
+
+ // Required for HTML labels if foreignObjects are disabled
+ var div = doc.createElement('div');
+ div.style.position = 'absolute';
+ div.style.left = dx + 'px';
+ div.style.top = dy + 'px';
+
+ var node = graph.container.firstChild;
+ var svg = null;
+
+ while (node != null) {
+ var clone = node.cloneNode(true);
+
+ if (node == graph.view.drawPane.ownerSVGElement) {
+ outer.appendChild(clone);
+ svg = clone;
+ } else {
+ div.appendChild(clone);
+ }
+
+ node = node.nextSibling;
+ }
+
+ doc.body.appendChild(outer);
+
+ if (div.firstChild != null) {
+ doc.body.appendChild(div);
+ }
+
+ if (svg != null) {
+ svg.style.minWidth = '';
+ svg.style.minHeight = '';
+ svg.firstChild.setAttribute('transform', 'translate(' + dx + ',' + dy + ')');
+ }
+ }
+
+ mxUtils.removeCursors(doc.body);
+
+ return doc;
+ },
+
+ /**
+ * Function: printScreen
+ *
+ * Prints the specified graph using a new window and the built-in print
+ * dialog.
+ *
+ * This function should be called from within the document with the graph.
+ *
+ * Parameters:
+ *
+ * graph -