# Generating PDF - NPM Plugin - jsPDF

**URL:** https://community.weweb.io/t/generating-pdf-npm-plugin-jspdf/5604
**Category:** How do I?
**Created:** [November 28, 2023, 8:40pm UTC](https://community.weweb.io/t/generating-pdf-npm-plugin-jspdf/5604 "2023-11-28T20:40:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![felipegranado](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/felipegranado/32/6306_2.png) [@felipegranado](https://community.weweb.io/u/felipegranado)
#### Post date: [November 28, 2023, 8:40pm UTC](https://community.weweb.io/t/generating-pdf-npm-plugin-jspdf/5604/1 "2023-11-28T20:40:08Z")

</div>

Hello everybody!

I’m trying to export HTML to PDF and I’ve seen some topics on the subject in the community. This one is a more specific question about the NPM Plugin:

I’m trying to use jsPDF and on WeWeb it’s saying “not defined” error for the `new jsPDF()` code.

However, when using the same code in another tool (JSFiddle) the same code works normally.

**[JSFiddle PDF Export Example](https://jsfiddle.net/felipe_douradinho/5r4ra6na/1/)**

This code can generate the PDF, but I can’t adapt it to work on the WebWeb. We can work to get it to work correctly…

The workaround I’m trying to do is create a blank page with the text that I want to save as a PDF and put to print. So I’m having success, but a direct PDF save would be more professional.

I would like to express my gratitude to the community for trying to help us with this challenge.

Best Regards,  
Thanks in advance.

---

<div class="post-metadata">

### Author: ![raydeck](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raydeck/32/384_2.png) [@raydeck](https://community.weweb.io/u/raydeck)
#### Post date: [November 28, 2023, 10:42pm UTC](https://community.weweb.io/t/generating-pdf-npm-plugin-jspdf/5604/2 "2023-11-28T22:42:23Z")

</div>

What error are you getting? Can you share more about the context in which you are having challenges?

---

<div class="post-metadata">

### Author: ![felipegranado](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/felipegranado/32/6306_2.png) [@felipegranado](https://community.weweb.io/u/felipegranado)
#### Post date: [November 29, 2023, 12:06pm UTC](https://community.weweb.io/t/generating-pdf-npm-plugin-jspdf/5604/3 "2023-11-29T12:06:30Z")

</div>

Hi @raydeck !

I need to create an export from HTML to PDF according to the HTML tags (in WORD it works fine).

Using the NPM plugin I can install the necessary libraries (jsPDF) but the code that the library creator puts for us to use doesn’t work on the WeWeb and as I don’t have 100% programming knowledge, I’m missing some part that I don’t know.

The objective is for the code to take the value of the variable and export it to PDF.

---

<div class="post-metadata">

### Author: ![raydeck](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raydeck/32/384_2.png) [@raydeck](https://community.weweb.io/u/raydeck)
#### Post date: [November 29, 2023, 1:04pm UTC](https://community.weweb.io/t/generating-pdf-npm-plugin-jspdf/5604/4 "2023-11-29T13:04:52Z")

</div>

To make progress, you need to _show_ what you have and where the error is, rather thae describing it. I find that one can do this with

1. copy-pasted text of code and response (the worst option, truth be told, since you don’t know what to copy-paste, and it leads to more iterations),
2. screenshots,
3. a recorded video (loom is a great resource for this) or
4. bringing to live office hours. [We do office hours on the hard part of low-code every day at State Change](https://statechange.ai).
