# Make a PDF file

**URL:** <https://discourse.nodered.org/t/make-a-pdf-file/2810>\
**Category:** General\
**Created:** [3 September 2018 17:29 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810 "2018-09-03T17:29:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Popo21](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Popo21](https://discourse.nodered.org/u/Popo21)\
**Post date:** [3 September 2018 17:29 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/1 "2018-09-03T17:29:11Z")

</div>

Can Node-RED make a PDF from string msg.payload ? I'm trying make a flow like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/7cf7e02a7ecac89ef6ecdd4ff4b80034367242da.png)  
but the pdf file cant opened. Is it possible to make a pdf file with Node-RED ?

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [3 September 2018 18:35 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/2 "2018-09-03T18:35:25Z")

</div>

Node-RED doesn't have built-in pdf functionality.  
There's a third party node that seems to do this however:

> **[node-red-contrib-pdf](https://flows.nodered.org/node/node-red-contrib-pdf)**
>
> Node for node-red to render html as a pdf file or stream

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [3 September 2018 19:02 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/3 "2018-09-03T19:02:53Z")

</div>

@Popo21 You did not say whether you are running on linux or something else. If linux, you can search Google for something like "linux text to pdf" and get a bunch of suggestions, all of which convert text files to pdf, either directly or through an intermediate postscript file. Your flow diagram suggests (I can't see into the function node) that you want to write the pdf file line-by-line. I doubt that this is possible, since pdf is a document format, and a pdf generator will want to see the entire document before it starts producing output -- hence, file-to-file conversion. I hope this helps.

@nlecaude I noticed this node also, but I doubt it does what it says on the tin. The node has been renamed on npm and GitHub as **[node-red-contrib-render](https://github.com/redconnect-io/node-red-contrib-render)**. I haven't tried it, but it seems to be an improved `template` node and not really much to do with pdf. (PS, I wonder whether the NR flow library is set up to track this sort of thing.)

---

<div class="post-metadata">

**Author:** ![Popo21](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Popo21](https://discourse.nodered.org/u/Popo21)\
**Post date:** [3 September 2018 19:39 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/4 "2018-09-03T19:39:46Z")

</div>

Thank You for your attention.  
I run that on raspberry, I try to use node-red-contrib-pdf node but give me error, now I'm trying use an API to convert txt to pdf, but how to save that file to my PI?  
I'm trying this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/d/d20f4e60ee785b4a6fc807ae0fe7e50b7f6a4e63.png)

---

<div class="post-metadata">

**Author:** ![Popo21](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Popo21](https://discourse.nodered.org/u/Popo21)\
**Post date:** [3 September 2018 20:09 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/5 "2018-09-03T20:09:29Z")

</div>

For now i think i will make that file as .odt file, thank you for your attention.

---

<div class="post-metadata">

**Author:** ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)\
**Post date:** [21 November 2018 11:25 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/6 "2018-11-21T11:25:03Z")

</div>

have you find a solution for pdf file

---

<div class="post-metadata">

**Author:** ![Popo21](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Popo21](https://discourse.nodered.org/u/Popo21)\
**Post date:** [24 November 2018 02:59 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/7 "2018-11-24T02:59:23Z")

</div>

I design a pdf form from html / template node, then the HTML form injected to file node. After that, a html file format created which can be transformed to pdf by drag that file to chromium and right click -\> print -\> save as pdf

---

<div class="post-metadata">

**Author:** ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)\
**Post date:** [24 November 2018 04:44 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/8 "2018-11-24T04:44:52Z")

</div>

Thanks for reply. I will try it.  
You dont use HTML-PDF NODE ? Right?

---

<div class="post-metadata">

**Author:** ![Popo21](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@Popo21](https://discourse.nodered.org/u/Popo21)\
**Post date:** [24 November 2018 09:13 UTC](https://discourse.nodered.org/t/make-a-pdf-file/2810/9 "2018-11-24T09:13:24Z")

</div>

yeah, just template and file node
