yWorks/jsPDF

Invalid Units

bpasham opened this issue · 4 comments

while using this in an iFrame (sandboxed) receiving error - Invalid units

it's on line number 3415 (call originated line # 14020) in the jspdf.debug.js

(i am using debug file to get the line numbers)

Any help is appreciated.

You are probably calling the jsPDF constructor wrong. The unit parameter you pass to jsPDF is wrong. You can either call it with regular arguments:

new jsPDF('p', 'pt', [width, height])

or with an option object

new jsPDF({
  orientation: 'p',
  unit: 'pt',
  format: [widht, height]
})

Valid units are pt, mm, cm, in, px, pc, em, ex.

It's not the call we are making from the code which is causing the issue. When .html method is called, there is another call coming from html2canvas which is causing the issue. the option parameter is receiving some sort of promise

  • see attached screenshots.
    2019-10-25 13_33_11-jspdf debug js - DocGen - Visual Studio Code
    2019-10-25 13_34_13-jspdf debug js - DocGen - Visual Studio Code

Does this only occur when executed in an iframe? Could you provide a minimal repro? Could you also test if this issue also occurs with the original jsPDF version?

Closing because of inactivity. Reopen if this is still an issue.