@RussCoder RussCoder released this Oct 19, 2018 · 6 commits to master since this release

Assets 5

Support of indirect djvu files. The base url should be provided to the viewer to work with an indirect djvu. Look at the website for more info.

@RussCoder RussCoder released this Sep 14, 2018 · 15 commits to master since this release

Assets 5

The library now processes the rotation flags and rotates the page by default if required.

@RussCoder RussCoder released this Aug 27, 2018 · 17 commits to master since this release

Assets 5

The API has been extented:

  • loadDocument(buffer, name = "***", config = null) - accepts the ArrayBuffer and a name of a document which should be shown at footer (it's optional).
  • async loadDocumentByUrl(url, config = null) - loads the documents as an ArrayBuffer and then invokes the previous method.
  • configure(config) - just sets the options. Note, that when a document is loaded some options are reset to the initial ones, so you have to call the method again or use the last parameter of the two previous methods.

The config is an object containing options for the viewer. Right now,the only one option is available, namely the rotation of a page: {pageRotation: 90}. There are 4 valid values: 0, 90, 180 and 270.

@RussCoder RussCoder released this Aug 20, 2018 · 18 commits to master since this release

Assets 5

How to use it:

<!DOCTYPE html>
<html>

<header>
    <meta charset="utf-8">
    <script src="djvu.js"></script>
    <script src="djvu_viewer.js"></script>
    <link href="djvu_viewer.css" rel="stylesheet">

    <script>
        window.onload = function () {
            // save as a global value
            window.ViewerInstance = new DjVu.Viewer(); 
            // render into the element
            window.ViewerInstance.render(
                document.querySelector("#for_viewer")
            );
        };
    </script>

    <style>
        /* make it pretty-looking */

        body {
            height: 100vh;
            margin: 0;
        }

        #for_viewer {
            height: 80vh;
            width: 90vw;
            margin: 5vh auto;
            border: 1px solid black;
        }
    </style>

</header>

<body>
    <div id="for_viewer"></div>
</body>

</html>

Furthermore, the viewer has a program API, which allows to open djvu files programmatically:

  • loadDocument(buffer, name) - which accepts the ArrayBuffer and a name of a document which should be shown at footer(it's optional).
  • async loadDocumentByUrl(url) - which loads the documents as an ArrayBuffer and then invokes the previous method.

@RussCoder RussCoder released this Aug 5, 2018 · 25 commits to master since this release

Assets 5

How to use:

<!DOCTYPE html>
<html>

<header>
    <meta charset="utf-8">
    <script id="djvu_js_lib" src="djvu.js"></script>
    <script src="djvu_viewer.js"></script>
    <link href="djvu_viewer.css" rel="stylesheet">

    <script>
        window.onload = function () {
            DjVu.Viewer.init(
                document.querySelector("#for_viewer")
            );
        };
    </script>

</header>

<body>
    <div id="for_viewer"></div>
</body>

</html>