# Html-pdf Node Error

**URL:** <https://discourse.nodered.org/t/html-pdf-node-error/3248>\
**Category:** General\
**Created:** [18 September 2018 19:54 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248 "2018-09-18T19:54:38Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharyalan09](https://avatars.discourse-cdn.com/v4/letter/z/a587f6/32.png) [@zacharyalan09](https://discourse.nodered.org/u/zacharyalan09)\
**Post date:** [18 September 2018 19:54 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/1 "2018-09-18T19:54:38Z")

</div>

Hello -

I'm getting the below error when trying to use the html-pdf node on a rasberry pi zero. When running the same flow on a windows machine I'm successful. I've looked around the internet and found a few folks having the same issues but haven't seen any solutions that have worked for me.

Any ideas here?

> html-pdf: Failed to load PhantomJS module. You have to set the path to the PhantomJS binary using 'options.phantomPath'

Flows:

> [{"id":"a2ca1b99.8e3b58","type":"inject","z":"dab759db.e53268","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":580,"y":300,"wires":[["749a0511.1f7fbc"]]},{"id":"7c709ea2.06658","type":"HTML-PDF","z":"dab759db.e53268","name":"HTML-PDF","output":"buffer","x":1050,"y":300,"wires":[["e04af8f8.c83988"]]},{"id":"dae17c02.27b01","type":"template","z":"dab759db.e53268","name":"HTML","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"\n\n\n \n Basic Web Page\n \n \n \n \t\n \<h3 style="text-align:center"\>Test Message Header\n\n
> 
> Test Message \<span style="color: blue;"\>
> 
> \n \n\n","output":"str","x":890,"y":300,"wires":[["7c709ea2.06658"]]},{"id":"e04af8f8.c83988","type":"file","z":"dab759db.e53268","name":"","filename":"test.pdf","appendNewline":true,"createDir":true,"overwriteFile":"true","x":1220,"y":300,"wires":[]},{"id":"749a0511.1f7fbc","type":"function","z":"dab759db.e53268","name":"Variables","func":"msg.site = 9999;\nmsg.date = 8888;\nmsg.row\_number = 7777;\nmsg.unit\_number = 6666;\nmsg.gear\_box\_date\_code = 5555;\nmsg.gear\_box\_hours\_in\_service = 4444;\nmsg.gear\_box\_years\_in\_service = 3333;\nmsg.rbc\_years\_in\_service = 2222;\nmsg.torque\_arm\_angle = 1111;\nmsg.peak\_torque = 1212;\nmsg.max\_imbalance = 1313;\n\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":300,"wires":[["dae17c02.27b01"]]}]

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

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [18 September 2018 20:13 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/2 "2018-09-18T20:13:42Z")

</div>

Are you talking about the node node-red-contrib-pdf ? If so I would suggest opening an inside on the nodes github page as you cannot guarantee that the author will read this forum

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 September 2018 20:31 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/3 "2018-09-18T20:31:39Z")

</div>

Have you installed the pre-reqs for linux... ?

> **[pofider/phantom-html-to-pdf](https://github.com/pofider/phantom-html-to-pdf)**
>
> Highly scalable html to pdf conversion using phantom workers - pofider/phantom-html-to-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:** [21 November 2018 13:46 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/4 "2018-11-21T13:46:11Z")

</div>

have you figure out a solution ?

---

<div class="post-metadata">

**Author:** ![wojtekdera](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wojtekdera/32/15912_2.png) [@wojtekdera](https://discourse.nodered.org/u/wojtekdera)\
**Post date:** [24 January 2020 11:36 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/5 "2020-01-24T11:36:38Z")

</div>

Have any one found the solution? I have this same problem on Windows server. The git hub repository link is not valid anymore. I can't reach the author.

Can anyone help?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 January 2020 11:52 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/6 "2020-01-24T11:52:25Z")

</div>

> **[pofider/phantom-html-to-pdf](https://github.com/pofider/phantom-html-to-pdf)**
>
> Highly scalable html to pdf conversion using phantom workers - pofider/phantom-html-to-pdf

"This repository has been archived by the owner. It is now read-only."

I'm afraid that you will need to find something else or fork the module and fix the error then get the node's author to change to your fork.

---

<div class="post-metadata">

**Author:** ![wojtekdera](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wojtekdera/32/15912_2.png) [@wojtekdera](https://discourse.nodered.org/u/wojtekdera)\
**Post date:** [24 January 2020 11:58 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/7 "2020-01-24T11:58:38Z")

</div>

I don't know how to edit nodes ;/  
are there people who need to display data in the form of a pdf report in the node red forum? Does only a handful of people need it and it is not the main topic? 😛

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 January 2020 15:20 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/8 "2020-01-24T15:20:14Z")

</div>

I think that, from the previous replies, not many people were that engaged I'm afraid. I'd love to help but unfortunately, I'm already over-committed with other work and projects.

I do note that there are a number of ways to convert HTML to PDF with the help of Node.js (which is what underpins Node-RED). It may be that you can find another Node.js module and get it to work with Node-RED. You can `require()` Node.js modules onto the global variables from `settings.js` and then access that in a function node and there is a reasonable chance that will work. But obviously, it does need some JavaScript knowledge.

---

<div class="post-metadata">

**Author:** ![wojtekdera](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wojtekdera/32/15912_2.png) [@wojtekdera](https://discourse.nodered.org/u/wojtekdera)\
**Post date:** [27 January 2020 14:20 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/9 "2020-01-27T14:20:22Z")

</div>

Thank you, I didn't know that. I will try that if this node fails me again.

I spend some time again on that node trying to make it work again and I didn't read this thread. It turned out that when I set it up on Windows Server sometimes it opens several instances of the node red and then this error happens.

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

After ending all of instances and starting again Node-Red the error disappears and HTML-PDF node works again like on normal Windows.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [27 January 2020 15:24 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/10 "2020-01-27T15:24:52Z")

</div>

So you are running Node-RED just to do the conversion? How are you starting it up? Do you really have multiple instances of Node-RED left running or are those cmd.exe entries the result of your Node-RED flow running the converter that maybe runs a background command shell? If you add the "Command Line" column to the task manager, you should be able to see exactly what is being run.

Node-RED itself appears as a node.js executable:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b42011f298c8ee96bc4e24270cb10624a0999452.png)

The conhost entries are the underlying terminal feature of Windows, you don't need to worry about those. You will get one for each shell command (cmd.exe, powershell.exe or pwsh.exe)

---

<div class="post-metadata">

**Author:** ![wojtekdera](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wojtekdera/32/15912_2.png) [@wojtekdera](https://discourse.nodered.org/u/wojtekdera)\
**Post date:** [27 January 2020 17:34 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/11 "2020-01-27T17:34:17Z")

</div>

Yes, I run Node-red.cmd to run my program, is there a simpler way to start my flow after I write the program on my server? What did you mean by "conversion"?

I have set **Task Scheduler** to run C:\Users\Wojtek\AppData\Roaming\npm\node-red.cmd  
then my program appears in the localhost and the user can use it from user's computer.

And yes, there are sometimes a few instances of this two commands shells and always only one instance of Node.js (green icon) but then the problem with generating pdfs appears. And I think it is sctricte Task Scheduler fault and my poor understanding of it.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [27 January 2020 18:40 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/12 "2020-01-27T18:40:28Z")

</div>

> [@wojtekdera](#):
>
> I run Node-red.cmd to run my program, is there a simpler way to start my flow after I write the program on my server?

No, that's fine, just checking that you didn't have Node-RED running as a service which many people do.

> [@wojtekdera](#):
>
> What did you mean by "conversion"?

HTML-to-PDF

> [@wojtekdera](#):
>
> And yes, there are sometimes a few instances of this two commands shells and always only one instance of Node.js (green icon) but then the problem with generating pdfs appears. And I think it is sctricte Task Scheduler fault and my poor understanding of it

Actually, I think it may be the software's fault because I think that it is starting a shell process but that isn't finishing. So if you run the flow again, you probably get a second shell that doesn't end. Maybe it isn't doing it all the time but there is something that stops the shell from ending.

Don't really think I can help further - as the underlying library is no longer supported, I'm not sure what can be done.

Is it always the same web page you are trying to convert?

---

<div class="post-metadata">

**Author:** ![wojtekdera](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wojtekdera/32/15912_2.png) [@wojtekdera](https://discourse.nodered.org/u/wojtekdera)\
**Post date:** [28 January 2020 09:49 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/13 "2020-01-28T09:49:45Z")

</div>

I wrote my own template to use it with this HTML-PDF node and I only populate it with different data, so yes.  
Ok thank you for your support. I think I can go by myself from this point. Thank so much

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 January 2020 12:32 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/14 "2020-01-28T12:32:26Z")

</div>

OK, no problem. The thing is, if you are using your own template then I wouldn't do it that way at all. I would pass the data to a command line converter and do it all that way. Simple and robust.

---

<div class="post-metadata">

**Author:** ![wojtekdera](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wojtekdera/32/15912_2.png) [@wojtekdera](https://discourse.nodered.org/u/wojtekdera)\
**Post date:** [28 January 2020 12:53 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/15 "2020-01-28T12:53:21Z")

</div>

could you be more specific? What command line converter? Is there a converter to meke pdfs? 😛

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 January 2020 13:03 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/16 "2020-01-28T13:03:14Z")

</div>

[https://www.startpage.com/do/dsearch?query=windows+command+line+convert+html+to+pdf&cat=web&pl=opensearch&language=english](https://www.startpage.com/do/dsearch?query=windows+command+line+convert+html+to+pdf&cat=web&pl=opensearch&language=english)

Plenty.

Pandoc is one of the most commonly used and converts masses of different formats.

[https://pandoc.org/installing.html](https://pandoc.org/installing.html)

---

<div class="post-metadata">

**Author:** ![wojtekdera](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wojtekdera/32/15912_2.png) [@wojtekdera](https://discourse.nodered.org/u/wojtekdera)\
**Post date:** [28 January 2020 14:30 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/17 "2020-01-28T14:30:14Z")

</div>

1. What you are using as an internet search engine 😛

2. How about that. I didn't know that. I will try it. Can you copy this to the second (my) thread about pdf making?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 January 2020 18:52 UTC](https://discourse.nodered.org/t/html-pdf-node-error/3248/18 "2020-01-28T18:52:55Z")

</div>

> [@wojtekdera](#):
>
> What you are using as an internet search engine

[Startpage.com](http://Startpage.com) - it is a privacy focused search engine. I only ever use Google if I can't find things using startpage. You may have heard of the alternative which is DuckDuckGo. I used to use DDG but found that SP has some slightly better search options.
