pdfkit-table icon indicating copy to clipboard operation
pdfkit-table copied to clipboard

Typescript errors even in the most basic examples

Open vresetnikov opened this issue 1 year ago • 4 comments

Hello,

Your docs state that pdfkit-table is a plugin. Does it mean that it requires pdfkit installed separately to run or is it standalone? I am assuming it is standalone and therefore I did not install the original pdfkit library nor its @types/pdfkit module.

I have "pdfkit-table": "^0.1.99" and "typescript": "^4.9.4" installed and none of the examples provided in your docs work.

Take your most basic example:

    import PDFDocument from "pdfkit-table";
    // init document
    let doc = new PDFDocument({ margin: 30, size: 'A4' });
    // save document
    doc.pipe(fs.createWriteStream("./document.pdf"));

    await (async function createTable(){
        // table
        const table = {
            title: '',
            headers: [],
            datas: [ /* complex data */ ],
            rows: [ /* or simple data */ ],
        };

        await doc.table(table, { /* options */ });
        doc.end();
    })();
    

Will return the following errors:

image

image

image

vresetnikov avatar Feb 20 '23 10:02 vresetnikov