Generate pdf with jspdf and Vue.js

First import the PDF library as:

import jsPDF from 'jspdf'

Then simply instantiate the object and give it the contents:

methods: {
  createPDF () {
    let pdfName="test"; 
    var doc = new jsPDF();
    doc.text("Hello World", 10, 10);
    doc.save(pdfName + '.pdf');
  }
}

Make sure to read the documentation for more

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)