How to make the canvas scrollable to contain multiple pdf scanned pages?

I start with HTML5.

I use Canvas to draw it, and I want the following features:


  • The canvas resolution is expandable, so if the image was set to scanned pdfs , I can show all the images (pdf pages).

  • I want the functionality (undo and redo) through the canvas.

+4
source share
1 answer

I did this before, saving the canvas state using the toDataUrl method for undo_array:

 var undo_array = []; 

so before any changes you make:

 undo_array.push(myCanvas.toDataURL("image/png")); 

now that the cancel button is pressed just restore the previous image:

 var myImg = new Image(); oImg.onload = function() { var ctx = document.getElementById("canvasID").getContext("2d"); ctx.drawImage(myImg, 0, 0); } myImg.src = undo_array.pop(); 

but if you also change the capture of the canvas, I think you can use another array to store / restore the changes.

+2
source

All Articles