Make a PDF file

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


but the pdf file cant opened. Is it possible to make a pdf file with Node-RED ?

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

@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. 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.)

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:

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

have you find a solution for pdf file

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

1 Like

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

yeah, just template and file node