parallax/jsPDF

pageSize.width & pageSize.height are undefined

Closed this issue · 4 comments

Are you using the latest version of jsPDF?
jsPDF 1.4.1

Have you tried using jspdf.debug.js?
Yes

Steps to reproduce
Create a new jsPDF instance and try to access internal.pageSize.width/height. They are undefined/NaN.
Example: jsbin

What I saw
pageSize.width & pageSize.height are undefined

What I expected
pageSize.width & pageSize.height should contains the actual page values.

Note:

  • Using pageSize.getWidth()/pageSize.getHeight()works, but Typescript will marks it as an error and prevent angular 2+ from compile correctly. Example
  • In 1.3.5 all works correctly

Experiencing exact same problem

You should use the release v1.3.5 to work with pageSize.height as we can see in this line: https://github.com/MrRio/jsPDF/blob/v1.3.5/jspdf.js#L1146

After release v1.4.0 they encapsulated it and change to pageSize.getHeight()

If you want to use the release v1.4.1 with @type/jspdf you must send updates to DefinitelyTyped (https://github.com/DefinitelyTyped/DefinitelyTyped/)

Why cant you use it with typescript?

Duplicate of #1943