Skip to content

Advanced configuration

mateusz-matela edited this page Dec 21, 2015 · 7 revisions

To change advanced configuration, create a DJVU_CONTEXT object in JavaScript before the page loading finishes, for example:

	var DJVU_CONTEXT = {
		file: "document.djvu",
		background: "#FFF"
	};

Available properties are:

  • file - path to the main DjVu document file, either absolute or relative to current page URL. Can be also provided in the URL as parameter (http://example.com/html_djvu?file=index.djvu) or as an attribute in the div tag for the viewer (<div id="djvuContainer" file="index.djvu">).
  • tileSize - width and height (in pixels) of tiles that the page view is divided into for rendering one by one. Larger tiles may result in quicker rendering overall, but would mean that users don't see any progress for a longer time. The default is 512 pixels.
  • tileCacheSize - how many rendered tiles can be stored in memory. Larger value means more memory consumption, but more space for keeping previous pages and pre-rendering future pages leads to more fluent switching pages. Memory consumption can be estimated in bytes as 4 * tileSize^2 * tileCacheSize + overhead, where overhead depends on browser type. The default is 256.
  • fileCacheSize - how much memory (in bytes) can be used to store downloaded DjVu files. Bigger value means more memory consumption, but smaller chance that user will have to wait for download after switching page. ** The default is 8 MB.**
  • pageCacheSize - how much memory (in bytes) can be used to store decoded pages. Bigger value means more memory consumption but smaller chance that user will need to wait for decoding after switching page. The default is 64 MB.
  • background - string representation of the viewer background color, compliant with CSS color definition. The default is "#666".
  • pageMargin - how much empty space (in pixels) can be visible when user scrolls to the border of the page. The default is 8 pixels.
  • screenDPI - value used to calculate how large the page should be presented on the screen at 100% zoom (and other zooms indirectly). Larger value means larger representation. The default is 96.
  • maxZoom - maximum value (in percents) the user can type in as requested zoom. The default is 10000.

Clone this wiki locally