Javascript: read djvu online


Use library: minidjvu.js

And BlobBuilder.js here.

HMTL:

<html>
	<head>
		<title>Simple online reader</title>
        <script src="BlobBuilder.js"></script>
		<script type='text/javascript' src='minidjvu.js'></script>
	</head>
	
	<body onload="drawdjvu()">
	
	    <script type='text/javascript'>
			var pageNumber = 1;	
			function drawdjvu()
			{
				renderdjvu('data/'+pageNumber+'.djvu','djvucanvas')
			}
		</script>
			
		<input type="button" onclick="pageNumber -= 1;  drawdjvu()" value="<" /> 
		<input type="button" onclick="pageNumber += 1;  drawdjvu()" value=">" /> 
		<input type='submit' onclick='document.getElementById("djvucanvas").width+=50; drawdjvu()' value='+' />
		<input type='submit' onclick='document.getElementById("djvucanvas").width-=50; drawdjvu()' value='-' />
		<br/>		
		<canvas id="djvucanvas" width="800" height="1200"></canvas>
	
</body>
</html>

Online demo

Leave a Reply