Jspdf: addHTML() and fromHTML() is not populating in angular version >8

Created on 5 Oct 2020  路  8Comments  路  Source: MrRio/jsPDF

addHTMl() and fromHTML() is not populating on angular vesion > 8

Most helpful comment

Same problem here in React
Yeah I solve the problem, instead of using addHTML() , you can use directly use html() a callback function.
e.g

`var doc = new jsPDF();

doc.html(document.body, {
callback: function (doc) {
doc.save();
}
});`

All 8 comments

Same problem here in React

Same problem here in React
Yeah I solve the problem, instead of using addHTML() , you can use directly use html() a callback function.
e.g

`var doc = new jsPDF();

doc.html(document.body, {
callback: function (doc) {
doc.save();
}
});`

addHTML and fromHTML were replaced with html in 2.x. The typings still contain them, but this is a bug we will fix with the next version.

Thanks for pointing to the html function. How can I add the typings for it?

The typings are located at types/index.d.ts. The TypeScript compiler should pick them up automatically, when using node resolving/npm.

Thanks @HackbrettXXX but the typings are wrong. I thought I can get them right myself to reflect the new .html method.

What exactly is wrong with the typings? Note that there are some issues with the margins and positioning currently (e.g. #2924). If you want to correct them a pull request would be very welcome :)

What exactly is wrong with the typings? Note that there are some issues with the margins and positioning currently (e.g. #2924). If you want to correct them a pull request would be very welcome :)

I finally know why I added the margin attribute, but it didn't work. 馃槄So if I want to use the margin attribute, which version should I reduce to?

Was this page helpful?
0 / 5 - 0 ratings