I am able to load image on canvas but now I want to replace the Image with pdf file. How to load Pdf file on Canvas as a image.src?
Asked
Active
Viewed 3.4k times
7
-
Does it need to be on canvas? If you just embed it in the document, it comes with some tools that pan and zoom, but I am not sure of your purposes. – user2550807 Jul 05 '13 at 13:20
-
1) I will be importing pdf file. 2) Will plot dots or circles or markers on that pdf. 3) When I will Zoom in and Zoom out pdf at that time need to zoom in and zoom out only pdf file but not the markers which i plotted on pdf. Markers need to translate on their respective positions without scaling. 3) With the mouse drag should be able to Pan that pdf file. These are the project requirements. I implemented this with Image. But I want to do this with pdf file. pdf.js will help in this told by some people. If you know any other idea about this then will be great help. Thanks – fmt.Fprint Jul 06 '13 at 04:40
1 Answers
3
You can achieve this with pdf.js https://github.com/mozilla/pdf.js/
Take a look at this article http://www.codediesel.com/javascript/rendering-pdf-in-html5-canvas/

mguimard
- 1,881
- 13
- 14
-
-
I am able to Zoom and Pan Image on canvas. Similarly I want to do with pdf file. So is this possible with canvas + HTML5 + Javascript ? – fmt.Fprint Jul 05 '13 at 13:05
-
Sure you can zoom on canvas. http://stackoverflow.com/questions/3420975/html5-canvas-zooming – mguimard Jul 05 '13 at 13:05
-
I am done with Image. But with pdf.js can I Zoom + pan pdf file on canvas? I am not getting any example related to pdf zoom/pan on canvas. – fmt.Fprint Jul 05 '13 at 13:11
-
Whatever is drawn in the canvas (pdf or images) you can zoom and pan programmatically. – mguimard Jul 05 '13 at 13:12