I'm trying to centre some text onto a PDF. I'm using jsPDF and found this solution;
Is there any way to center text with jsPDF?
My problem is I get an error when running this.
split_text_to_size.js:47 Uncaught (in promise) TypeError: Cannot read property 'widths' of undefined(…)
API.getCharWidthsArray @ split_text_to_size.js:47
API.getStringUnitWidth @ split_text_to_size.js:95
<my function>
The function getCharWidthsArray() uses this.internal.getFont() which returns this object:
Object {
PostScriptName: "Helvetica"
encoding: "StandardEncoding"
fontName: "helvetica"
fontStyle: "normal"
id: "F1"
metadata: {}
The metadata object doesn't have anything, yet the function is trying to get Unicode.widths of that object. Is there a work around?