fromHTML is not a function when I use jsPDF in vue
See original GitHub issue<script>
import { jsPDF } from 'jspdf'
...
export default {
methods: {
getPdf() {
const printDoc = new jsPDF('p', 'in', 'letter')
console.log('printDoc', printDoc)
// There is no method fromHTML in what is printed,so when I use printDoc
// the console reports error: fromHTML is not a function
},
},
}
</script>
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
fromHTML is not a function when I use jsPDF in vue #2992
The fromHTML function was replaced by html in 2.0.0. Unfortunately, the typings currently still contain the fromHTML method but a fix is under ......
Read more >doc.fromHTML is not a function jsPDF - Stack Overflow
I uploaded to jsFiddle and works... but when I try it in my browser doesnt works and I get the error doc. fromHTML...
Read more >Creating a PDF using jspdf.fromHTML : r/vuejs - Reddit
fromHTML. So i was working on a personal project and was trying to use jsPDF to create a pdf file using HTML. What...
Read more >jsPDF from html - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
Read more >doc.fromHTML is not a function Code Example
The fromHTML function was replaced by html in 2.0.0. Unfortunately, the typings currently still contain the fromHTML method but a fix is und....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kamildudek6 simple to explain: In jsPDF@1.5.3 there were 4 different functions to convert HTML to PDF (fromHTML, addHTML, html2pdf, and html). Each had its own API and feature set. It was quite confusing for developers to decide which function to use. Since
html
had the most complete feature set and the most promising technological approach, it was chosen as the single HTML function for 2.0.0. The others were already marked as deprecated in 1.5.x. Between 1.5.3 and 2.0.0 developers had almost two years to port their code tohtml
. Since a new major release with other breaking changes was already planned, it was only logical to remove all the old deprecated functions.Another big point is maintenance and support. This project is currently maintained by a single person (me), and it is just not feasible to maintain 4 different variants of HTML functions, all with their own bugs and missing features. I hardly have the time maintain one of them properly. Please keep in mind this is an open source project, which everyone can use for free.
And, lastly, if you really want to use one of the old HTML functions, no one keeps you from installing 1.5.3 again or even forking the project and merge the old function with the 2.x code.
Also, please refrain from phrases like “junior dev move” if you don’t know the details behind design decisions. That’s not very kind and, IMHO, GitHub is not the right place for that. IMO, conversations on GitHub should remain purely technical and not emotional.
The
fromHTML
function was replaced byhtml
in 2.0.0. Unfortunately, the typings currently still contain thefromHTML
method but a fix is under way.