I'm trying to recreate the pdf preview thing on the jspdf site so I can test out some stuff programatically at my leisure. Looking at the site's source, the html is:
<iframe src="datauri:application/pdf;base64,blahblahblah">
<html>
<body>
<embed src="same as above" type="application/pdf" />
</body>
</html>
</iframe>
jsfiddle doesn't play nice with embedded <html>
so I've tried various combinations of:
//Cannot read property "canvas" of undefined
<img id="pdf" />
$("#pdf").attr("src", doc.output("datauristring"));
...
//Cannot read property "canvas" of undefined
<embed id="pdf" type="application/pdf" />
document.querySelector("#pdf").src = doc.output("datauristring");
I also tried implementing a canvas and drawing the datauri as detailed here, but that didn't work either. Here's my fiddle.