Getting started

WebODF makes all source code available. Everybody is allowed to download and modify it. Below are instructions to get started on WebODF.

Using WebODF on your own web page

In a few steps, you can add WebODF to your website. Only one file is needed from the project: webodf.js. With a JavaScript snippet like the following, one can display an ODF file in an HTML page:

  <script src="webodf.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" charset="utf-8">
function init() {
  var odfelement = document.getElementById("odf"),
      odfcanvas = new odf.OdfCanvas(odfelement);
window.setTimeout(init, 0);
  <div id="odf"></div>

Obtaining the source code

The file webodf.js is created from a collection of JavaScript files. These files can be checked out from the git repository or downloaded.

Creating webodf.js

webodf.js is compiled by using the closure compiler. This compiler compacts all JavaScript files, so that they are smaller and execute faster. CMake is used to setup the buildsystem, so webodf.js can be created:

git clone webodf
mkdir build
cd build
cmake ../webodf
make webodf.js-target

A successfull run will yield the file webodf.js in the subfolder build/webodf/ (among other things), from where you can then copy it and use for your website.