# How to output as PDF?

**URL:** https://community.weweb.io/t/how-to-output-as-pdf/1509
**Category:** How do I?
**Created:** [November 28, 2022, 1:51pm UTC](https://community.weweb.io/t/how-to-output-as-pdf/1509 "2022-11-28T13:51:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![peteletkemansst](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@peteletkemansst](https://community.weweb.io/u/peteletkemansst)
#### Post date: [November 28, 2022, 1:51pm UTC](https://community.weweb.io/t/how-to-output-as-pdf/1509/1 "2022-11-28T13:51:47Z")

</div>

There are some pure JavaScript libraries such as jsPDF ([jsPDF - HTML5 PDF Generator | Parallax](https://parall.ax/products/jspdf)).  
How can I output a page generated in WeWeb as a PDF?  
Is it possible to do this with a pure JavaScript library or do I have to use a third party web site/service such as [https://www.api2pdf.com/](https://www.api2pdf.com/) ?  
I suppose I could take jsPDF and put it on AWS or something like that and enable some restful inputs.

I may have reports with 10-30 pages.  
What is the recommended procedure to get WeWeb to output a PDF.

---

<div class="post-metadata">

### Author: ![peteletkemansst](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@peteletkemansst](https://community.weweb.io/u/peteletkemansst)
#### Post date: [November 28, 2022, 4:16pm UTC](https://community.weweb.io/t/how-to-output-as-pdf/1509/2 "2022-11-28T16:16:55Z")

</div>

This is at least a start.

> **[How to design runtime generated PDF via HTML ? - GeeksforGeeks](https://www.geeksforgeeks.org/how-to-design-runtime-generated-pdf-via-html/)**
>
> A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

I added  
`<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.2/html2pdf.bundle.js"></script>`  
to the custom code shown below

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/4f8394011d9742966f79a29311e1842da953b3c8.png)  
Then I added this as custom JS

```auto
var makepdf = document.getElementById("makepdf"); //id of section to be exported
html2pdf().from(makepdf).save();

```

I haven’t try multiple pages, custom file names or anything like that yet.

---

<div class="post-metadata">

### Author: ![peteletkemansst](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@peteletkemansst](https://community.weweb.io/u/peteletkemansst)
#### Post date: [November 28, 2022, 4:22pm UTC](https://community.weweb.io/t/how-to-output-as-pdf/1509/3 "2022-11-28T16:22:57Z")

</div>

Find documentation for the JS library here

> **[html2pdf.js](https://www.npmjs.com/package/html2pdf.js/v/0.9.0)**
>
> Client-side HTML-to-PDF rendering using pure JS. Latest version: 0.10.1, last published: a year ago. Start using html2pdf.js in your project by running \`npm i html2pdf.js\`. There are 57 other projects in the npm registry using html2pdf.js.
