jspdf: autoPaging error when set to 'text'

Viewed 189

i am using jspdf to create a pdf document from html and it works just fine. The only problem I have is the typing of the autoPaging property. TypeScript complains when I set it to 'text' even though the documentation specifies this option in order to prevent text from being sliced between pages.

My code:

export function createAndDownloadPDF(html: any, m: string) {
  const clone = html.cloneNode(true)
  clone.style.fontFamily = 'courier'
  clone.style.fontSize = '10px'
  const pdf = new jsPDF('p', 'pt', 'a4')
  const options = {
    
    autoPaging: 'text',

    callback: function(doc) {
      doc.save(m + '_' + moment(new Date()).format('YYYY-MM-DD') + '.pdf')
    },
    //fontFaces: [{ family: 'monospace' }],
    margin: [10, 10, 10, 10],
    x: 10,
    y: 10
  }

  pdf.html(clone, options)
}

The error I get states that string is not assignable to type 'boolean | "slice" | "text"'. Through the use of string literal types, specifying a specific string as a type is possible, so I don't understand where the error stems from. Is it the range of boolean and string?

enter image description here

0 Answers
Related