# How to generate PDF from HTML page/template with dynamic fields

**URL:** <https://community.weweb.io/t/how-to-generate-pdf-from-html-page-template-with-dynamic-fields/4833>\
**Category:** How do I?\
**Created:** [October 10, 2023, 7:57pm UTC](https://community.weweb.io/t/how-to-generate-pdf-from-html-page-template-with-dynamic-fields/4833 "2023-10-10T19:57:44Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [October 11, 2023, 10:08pm UTC](https://community.weweb.io/t/how-to-generate-pdf-from-html-page-template-with-dynamic-fields/4833/4 "2023-10-11T22:08:19Z")

</div>

Hey, check this out, might be what you’re looking for, you can Print → Save as PDF

> [@How to use print.css to print a page fitting A4 format](https://community.weweb.io/t/how-to-use-print-css-to-print-a-page-fitting-a4-format/4257):
>
> Hi there, I have a use case in which a user can view an invoice on the screen. I want to add a button to print the invoice, either printing to paper or pdf. The printed version should fit the a4 and should only have the invoice. So navbar and print button should be excluded from the printed version. I noticed I could use window.print(), but I did not succeed to apply a specific css. I als tried to set a state prior to the print event, but that didn’t work. Looking forward to see some tips an…

I also have a working demo there.

---

_[View the full topic](https://community.weweb.io/t/how-to-generate-pdf-from-html-page-template-with-dynamic-fields/4833)._
