# How to generate the PDF from Node-Red

**URL:** <https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469>\
**Category:** General\
**Tags:** node-red-dashboard, database, function-node\
**Created:** [28 June 2023 16:42 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469 "2023-06-28T16:42:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksthar](https://avatars.discourse-cdn.com/v4/letter/k/85f322/32.png) [@ksthar](https://discourse.nodered.org/u/ksthar)\
**Post date:** [28 June 2023 16:42 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/1 "2023-06-28T16:42:48Z")

</div>

Hello,

I want to ask something about generating the PDF using node-red.  
The PDF I want to generate is the water meter bill as shown in the photo.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1bac5d8d00396552b583e10ee7f1f08d9f96517a.jpeg)

How can I generate something like that?  
I already keep the meter reading data in the mySQL database.

Many Thanks,  
Simon

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [28 June 2023 16:48 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/2 "2023-06-28T16:48:09Z")

</div>

There are some pdf nodes available on the flows page of this site.

[https://flows.nodered.org/search?term=pdf](https://flows.nodered.org/search?term=pdf)

---

<div class="post-metadata">

**Author:** ![ksthar](https://avatars.discourse-cdn.com/v4/letter/k/85f322/32.png) [@ksthar](https://discourse.nodered.org/u/ksthar)\
**Post date:** [28 June 2023 16:53 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/3 "2023-06-28T16:53:22Z")

</div>

Hi ghayne,

Could you mind if you give me some examples?  
I am really bad at node-red.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [28 June 2023 16:57 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/4 "2023-06-28T16:57:01Z")

</div>

> [@ksthar](#):
>
> Could you mind if you give me some examples?  
> I am really bad at node-red.

I'm sorry, it's not something I have ever done.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 June 2023 19:21 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/5 "2023-06-28T19:21:01Z")

</div>

> [@ksthar](#):
>
> Could you mind if you give me some examples

Node-red-contrib-pdfmake has built in examples (`ctrl-i` \> examples) and there are many solutions on the forum.

> [@ksthar](#):
>
> I am really bad at node-red

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![ksthar](https://avatars.discourse-cdn.com/v4/letter/k/85f322/32.png) [@ksthar](https://discourse.nodered.org/u/ksthar)\
**Post date:** [29 June 2023 03:20 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/6 "2023-06-29T03:20:49Z")

</div>

Thanks Steve

I'll work on it now and please let me get back to you if I've some questions !

Cheers

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [29 June 2023 05:55 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/7 "2023-06-29T05:55:42Z")

</div>

Here are a couple of links to some of the threads @Steve-Mcl mentioned.

> [@How to push multiple array pdfmake](https://discourse.nodered.org/t/how-to-push-multiple-array-pdfmake/63839/1):
>
> please help to guidline code How to push multiple arry pdfmake 1 page var stuff = msg.payload[]; var dd = { content: stuff.map(function(item) { return { text: item, pageBreak: 'after'} }) }; msg.payload = dd; return msg;

> [@Has anyone used the 'pdfmake' node to embed an image in a document?](https://discourse.nodered.org/t/has-anyone-used-the-pdfmake-node-to-embed-an-image-in-a-document/74978/1):
>
> I'm trying to use this node to create a PDF from a 'document description' as a project for my IoT students to automatically create a newsletter using text and images from external sources. So far text insertion works fine, the problem is inserting an image as per the supplied example with the node. With help from @zenofmud I have this flow which uses http-request to insert an external image (from a remote server or a server like NGINX on a local RPi) successfully in to a document.

Here's a link to the "playground" with many examples of creating documents with different layouts.  
[http://pdfmake.org/playground.html](http://pdfmake.org/playground.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 August 2023 05:56 UTC](https://discourse.nodered.org/t/how-to-generate-the-pdf-from-node-red/79469/8 "2023-08-28T05:56:09Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
