JSFiddle - React, Tailwind, and code Playground
by vikikamath
HTML
<script src="https://rawgit.com/mozilla/pdf.js/gh-pages/build/pdf.js"></script>
<script id="template" type="text/ractive">
<canvas id="canvas"></canvas>
</script>
JavaScript
var url= 'https://cdn.mozilla.net/pdfjs/helloworld.pdf';
var ractive = new Ractive({
el: 'body',
template: '#template',
data: {
},
onrender: function() {
/*var canvas = document.getElementById("canvas");
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 55, 50);
ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
ctx.fillRect (30, 30, 55, 50);
}
}*/
PDFJS.disableWorker = true;
PDFJS.getDocument(url).then(function(pdf) {
this.pdfData = pdf;
})
}
});