I am actually trying to include jspdf in server side and then use it for simple pdf generation(simply the text \"Hello world!\")(Go to the url- get the pdf localhost:8080).
In extension to the answer provided by Simon Bengtsson:
I managed to handle even latin-1 characters by sending the output of jsPdf to encoding:
global.window = {document: {createElementNS: () => {return {}} }};
global.navigator = {};
global.btoa = () => {};
var fs = require('fs');
var jsPDF = require('jspdf');
var encoding = require('encoding')
var doc = new jsPDF();
doc.text("HelloäöüßÄÖÜ©µ®", 10, 10);
var data = doc.output()
var buffer = encoding.convert(data, "Latin_1")
fs.writeFileSync('./document.pdf', buffer);
delete global.window;
delete global.navigator;
delete global.btoa;