AurieaHarvey About Context Contact Index Random
Trail: BookReader

BookReader

Serving Images

In the case of the Standalone Demo, operation is fairly simple. Images are numbered sequentially and stored in a directory called “StandAloneImages”. The images are all the same size, and two functions in BookReaderJSSimple.js, getPageWidth() and getPageHeight(), return the page size. Scaling is done in the web browser.

Extending bookreader functionality

To make is it easier to work with other sources, the bookreader can expect a book interface from the client with the following methods.

getPageCount() getPage(index) getPageWidth(index) getPageHeight(index)
The book reader can have optional functionality which is enabled only when the book implementation has a specific method defined.
For example, bookmarks functionality can be enabled only when the book interface has getBookmarks method defined.
getBookmarks(index)
Typical usage:
<script src="/js/bookreader.js" type="text/javascript"/> <script src="/js/archivebook.js" type="text/javascript"/> <div id="book1"></div> <script> document.onload = function() { var b = bookreader("book1", ArchiveBook("tomsawyer")); b.showPage(42); } </script>