PDF Generation in html5

I have been trying to implement pdf generation in html5 (native in the long term).

Currently I’m trying to use openfl-alivePDF, however this doesn’t seem to work, even using the example supplied, it compiles, but when it runs the browser console reports an error in the code…

TypeError: $iterator(…) is not a function, which occurs at var _ = $iterator(it)(); in the following code…

Lambda.count = function(it,pred) {
var n = 0;
if(pred == null) {
var _ = $iterator(it)();
while(_.hasNext()) {
var _1 = _.next();
++n;
}
} else {
var x = $iterator(it)();
while(x.hasNext()) {
var x1 = x.next();
if(pred(x1)) {
++n;
}
}
}

Has this method of pdf generation been successfully implemented by anybody, or is there an alternative that could be used?

Thanks

Last time I tried openfl-alivePDF it was working but with limitations (don’t remember precisely). So I switched to https://github.com/MrRio/jsPDF.

Thanks for the reply.

Yes implementing a better supported pdf generator seems to be a better approach.

Did you integrate it with your haxe code via an extern? I’ve not tried to do that before.

You can add jspdf through the <dependency> tag in project.xml. And call it with ExternalInterface.call

Thanks looking into that now.

I notice there is a jsPDF extern on Git…

https://github.com/okawa-h/jsPDF-extern/tree/9b9ee5ddfd9d619d85b30403dbbcd8bffa0c3901