Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
508 views
in Technique[技术] by (71.8m points)

javascript - Convert html to pdf by using jsPdf in nuxtjs - mistake of doc.fromHTML

In my nuxt project , i want to convert my page component to Pdf. I checked many samples and almost all use doc.fromHtml to convert it to pdf. but I take error because of doc.fromHTML. I could not solve any solution and i insist of using jsPdf library . Because it is always updated.

 data() {
        return {
             margins : {
                top: 80,
                bottom: 60,
                left: 40,
                width: 522
            }

        }
    },
    
    methods: {
        generatePdf() {
            const doc = new jsPDF('p', 'pt', 'A4');

            doc.fromHTML(this.$refs.testHtml, this.margins.left, this.margins.top,{
                'width' : this.margins.width
            });

            doc.save('test.pdf');
        }
    }
question from:https://stackoverflow.com/questions/65920205/convert-html-to-pdf-by-using-jspdf-in-nuxtjs-mistake-of-doc-fromhtml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...