Skip to content

Advanced configuration

mateusz-matela edited this page Oct 25, 2017 · 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 16 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 128 MB.
  • background - string representation of the viewer background color, compliant with CSS color definition. The default is "#666".
  • uiHideDelay - how long (in milliseconds) it takes to hide the tool bar and scroll bars after the user interaction has stopped. Value of 0 means the UI will never be hidden. The default is 1500.
  • 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.
  • locationUpdateEnabled - if set to false, it disables the feature of updating the p parameter in address bar on page change. The default is true. If the p parameter is defined when the viewer is first opened, this setting is ignored.
  • textLayerEnabled - if set to false, it disables the support for the text layer. The default is true.
  • useWebWorkers - if set to false, the app will not use web workers and DjVu parsing/rendering will be done in the UI thread. The default is true, although in browsers that don't support web workers it's switched automatically.
Clone this wiki locally