« Previous - Version 4/10 (diff) - Next » - Current version
Mark Swain, 06/13/2011 04:47 pm


Using WebODF for viewing documents on a web server

New directions as of 2011-06-12

use webodf.js and webodf.css

  <link rel="stylesheet" type="text/css" href="webodf.css"/>
  <script src="webodf.js" type="text/javascript" charset="utf-8"></script>
function init() {
  var url = "myurl.odt",
        odfelement = document.getElementById("odf"),
        odfcanvas = new odf.OdfCanvas(odfelement);
    odfcanvas.load(url);
}
  </script>
  <title></title>
</head>
 <body onload='init()' >
  <div id="odf"></div>
</body>

webodf.js and webodf.css are located in the folder webodf and are the only two
files you need.

Previous directions

To deploy WebODF on a webserver on needs to check out the code from the git repository at

  http://git.gitorious.org/odfkit/webodf.git

or download a code package from
  http://gitorious.org/odfkit/webodf/archive-tarball/master

Copy these these two files and this directory from the directory webodf to your server:
  odf.html
  defaultodfstyle.css
  lib/

and add your ODF files. E.g. you can store the files in a directory called odf. The directory odf should be in the same folder as the file odf.html.
If this directory contains a file 'HelloWorld.odt' you can view it by entering this url in your browser:
  http://example.com/path/odf.html#odf/HelloWorld.odt

Replace http://example.com/path/ to the right path for your server.