yWorks / jsPDF

JavaScript PDF generation to work with SVG
MIT License
56 stars 23 forks source link

Invalid Units #28

Closed bpasham closed 4 years ago

bpasham commented 4 years ago

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.

HackbrettXXX commented 4 years ago

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.

bpasham commented 4 years ago

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

HackbrettXXX commented 4 years ago

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?

HackbrettXXX commented 4 years ago

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