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:
<html> <head> <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); odfcanvas.load("myfile.odt"); } window.setTimeout(init, 0); </script> </head> <body> <div id="odf"></div> </body> </html>
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 https://github.com/kogmbh/WebODF.git 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.