-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
I'm using Typescript in a React project and I follow the example for creating a table on the Live Demo site but I get the following error: getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.
I check the type of the arguments for .table()
and the headers
argument is string[]
which is unexpected because the demo is using object[]
. I change to the type asked for by the argument but I still get the same error.
Below is an MCVE in node:
const { jsPDF } = require('jspdf')
function test() {
const test = new jsPDF('landscape')
const headers = [
'Name',
'Student_Date_Of_Birth',
'Student_ID_No_Course',
'Course',
'Course_Total_Tuition_Fee',
'Course_Intake',
'Course_Year',
'Course_Start_Month',
'Commission_Rate',
'Commission_Payable'
]
const invoiceObjectTableRows = [
{
Name: 'testing',
Student_Date_Of_Birth: 'testing',
Student_ID_No_Course: 'testing',
Course: 'testing',
Course_Total_Tuition_Fee: 'testing',
Course_Intake: 'testing',
Course_Year: 'testing',
Course_Start_Month: 'testing',
Commission_Rate: 'testing',
Commission_Payabl: 'testing'
}
]
test.table(5, 105, invoiceObjectTableRows, headers, { autoSize: true })
}
test()
Metadata
Metadata
Assignees
Labels
No labels