First, allow me to apologize if this question has an obvious solution or exists elsewhere. I am a JavaScript newcomer and so don't have the requisite vocabulary established yet.
I'm trying to use the jsPdf library to construct a PDF programmatically. So far, things have worked pretty well. I installed the module using npm install jspdf --save and the import of the main library works without any problems:
import { jsPDF } from 'jspdf';
export function ConvertToPdf(data) {
const doc = new jsPDF({
orientation: 'portrait',
unit: 'px',
format: 'a4',
});
doc.save('test');
}
However, I'm trying to use the splitTextToSize, documented here, function to wrap some text but I can't seem to import it. I've tried a variety of combinations to import the module it's in:
import split_text_to_size;
import split_text_to_size.js;
import modules/split_text_to_size;
import modules/split_text_to_size.js;
import jspdft/modules/split_text_to_size;
I'm not sure if it's just not installed or the import path is different than what appears to be the case in the documentation. Any help here would be greatly appreciated.