# How to convert text files to PDF file

**URL:** <https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654>\
**Category:** General\
**Created:** [9 June 2022 05:26 UTC](https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654 "2022-06-09T05:26:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [9 June 2022 05:26 UTC](https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654/1 "2022-06-09T05:26:56Z")

</div>

Anyone have sample flow to text files to PDF file

---

<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:** [9 June 2022 07:05 UTC](https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654/2 "2022-06-09T07:05:56Z")

</div>

There are examples built in to [node-red-contrib-pdfmake](https://flows.nodered.org/node/node-red-contrib-pdfmake)

> ## Examples
> 
> Examples are provided using the default node-red way, i.e. use `import` in the editor menu and look for examples in the `node-red-contrib-pdfmake` package
> 
> ### #1 simple text PDF
> 
> This is the first example found on the pdfmake website.
> 
> ### #2 image & svg example PDF
> 
> This is a custom example showing how to read an image from file and integrate it into the PDF. It also shows a simple SVG to be included as well.

Try them & then try using a file node to load your text file & pass the text to it.

---

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [9 June 2022 08:52 UTC](https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654/3 "2022-06-09T08:52:04Z")

</div>

Hi Steve let you guidline flow?

---

<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:** [9 June 2022 08:56 UTC](https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654/4 "2022-06-09T08:56:01Z")

</div>

What have you tried?

Did you import any of the examples?

Do you have the text file loading into node-red?

Post your current work & someone will assist.

---

<div class="post-metadata">

**Author:** ![chawana](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chawana](https://discourse.nodered.org/u/chawana)\
**Post date:** [9 June 2022 09:16 UTC](https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654/5 "2022-06-09T09:16:26Z")

</div>

```auto
[{"id":"cf65376e4d875d23","type":"tab","label":"Flow 11","disabled":false,"info":"","env":[]},{"id":"292df816cf5b98e7","type":"debug","z":"cf65376e4d875d23","name":"file","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":520,"wires":[]},{"id":"cb7bfed7.2054a","type":"change","z":"cf65376e4d875d23","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"combined[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":420,"wires":[[]]},{"id":"87182c66.4a1d3","type":"debug","z":"cf65376e4d875d23","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":500,"wires":[]},{"id":"00345b79e1950558","type":"file function","z":"cf65376e4d875d23","name":"","filename":"D:\\log\\log.txt","reloadfile":true,"outputs":1,"x":430,"y":560,"wires":[["8aa58ee2326b776a","292df816cf5b98e7"]]},{"id":"376e69c962da4eb9","type":"file","z":"cf65376e4d875d23","name":"","filename":"","appendNewline":false,"createDir":true,"overwriteFile":"false","encoding":"none","x":840,"y":580,"wires":[["87182c66.4a1d3"]]},{"id":"8aa58ee2326b776a","type":"pdfmake","z":"cf65376e4d875d23","name":"","outputType":"base64","inputProperty":"payload","options":"{}","outputProperty":"payload","x":640,"y":580,"wires":[["376e69c962da4eb9"]]},{"id":"b620c47079446f2f","type":"inject","z":"cf65376e4d875d23","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":540,"wires":[["00345b79e1950558"]]}]

```

---

<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:** [8 August 2022 09:16 UTC](https://discourse.nodered.org/t/how-to-convert-text-files-to-pdf-file/63654/6 "2022-08-08T09:16:45Z")

</div>

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