diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2012-02-20 21:09:54 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2012-02-20 21:09:54 (GMT) |
commit | 34d4ace6d4037862b6d280f1d7534292c714bf59 (patch) | |
tree | a9a7b7b5542fbc9a2189f8ae6b39379770043b48 /src/svgpan_js.h | |
parent | c22d77a7a9c0f26a060a58047f514869a9e0a067 (diff) | |
download | Doxygen-34d4ace6d4037862b6d280f1d7534292c714bf59.zip Doxygen-34d4ace6d4037862b6d280f1d7534292c714bf59.tar.gz Doxygen-34d4ace6d4037862b6d280f1d7534292c714bf59.tar.bz2 |
Release-1.7.6.1-20120220
Diffstat (limited to 'src/svgpan_js.h')
-rw-r--r-- | src/svgpan_js.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/svgpan_js.h b/src/svgpan_js.h index 260d4f7..9978f21 100644 --- a/src/svgpan_js.h +++ b/src/svgpan_js.h @@ -278,4 +278,42 @@ " doZoom(g,p,factor);\n" "}\n" "\n" +"function serializeXmlNode(xmlNode) \n" +"{\n" +" if (typeof window.XMLSerializer != \"undefined\") {\n" +" return (new window.XMLSerializer()).serializeToString(xmlNode);\n" +" } else if (typeof xmlNode.xml != \"undefined\") {\n" +" return xmlNode.xml;\n" +" }\n" +" return \"\";\n" +"}\n" +"\n" +"/** \n" +" * Handler for print function\n" +" */\n" +"function handlePrint(evt)\n" +"{\n" +" evt.returnValue = false;\n" +" var g = svgDoc.getElementById(\"graph\");\n" +" var xs = serializeXmlNode(g);\n" +" try {\n" +" var w = window.open('about:blank','_blank','width='+windowWidth+',height='+windowHeight+\n" +" ',toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,location=0,directories=0');\n" +" var d = w.document;\n" +" d.write('<html xmlns=\"http://www.w3.org/1999/xhtml\" '+\n" +" 'xmlns:svg=\"http://www.w3.org/2000/svg\" '+\n" +" 'xmlns:xlink=\"http://www.w3.org/1999/xlink\">');\n" +" d.write('<head><title>Print SVG</title></head>');\n" +" d.write('<body style=\"margin: 0px; padding: 0px;\" onload=\"window.print(); window.close();\">');\n" +" d.write('<div id=\"svg\" style=\"width:'+windowWidth+'px; height:'+windowHeight+'px;\">'+xs+'</div>');\n" +" d.write('</body>');\n" +" d.write('</html>');\n" +" d.close();\n" +" } catch(e) {\n" +" alert('Print function not supported by this browser!');\n" +" }\n" +"}\n" +"\n" +"\n" +"\n" "\n" |