# P5.JS & jsPDF cant use 2.4.0 but 1.3.3 works

**URL:** <https://discourse.processing.org/t/p5-js-jspdf-cant-use-2-4-0-but-1-3-3-works/33792>\
**Category:** Libraries\
**Created:** [November 28, 2021, 4:29am UTC](https://discourse.processing.org/t/p5-js-jspdf-cant-use-2-4-0-but-1-3-3-works/33792 "2021-11-28T04:29:43Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 28, 2021, 7:27am UTC](https://discourse.processing.org/t/p5-js-jspdf-cant-use-2-4-0-but-1-3-3-works/33792/3 "2021-11-28T07:27:05Z")

</div>

Seems like this is a common case for UMD packed files.

That is, they have a namespace object which wraps up their actual main constructor.

For the jsPDF library we have a namespace jspdf and a main constructor jsPDF inside jspdf.

I had to do the same for the ml-matrix library:

> [@Autocomplete and documentation for "imported" p5js](https://discourse.processing.org/t/autocomplete-and-documentation-for-imported-p5js/31927/14):
>
> When we use import in JS 2 things happen: The file becomes a JS module and it needs a \<script type=module\> to load inside the HTML. JS checks the import line if a file w/ that exactly path & name exists so it can load it as a module. As we can note the file “ml-matrix” doesn’t exist. Instead there are “matrix.js” & “matrix.umd.js”. However neither is a JS module but just vanilla JS code. The library’s types is called “matrix.d.ts”. But to make things worse “matrix.umd.js” is exposed as …

In its UMD format ml-matrix has a namespace mlMatrix and a constructor Matrix inside mlMatrix:

> <https://github.com/GoToLoop/ML-Matrix-P5JS-Template/blob/v1.0.6/sketch.js#L10-L11>

---

_[View the full topic](https://discourse.processing.org/t/p5-js-jspdf-cant-use-2-4-0-but-1-3-3-works/33792)._
