Newbie - Show PDF in Dashboard


I would like to show a PDF file in dashboard.
File is stored in home/www/cpt/manuali with name Manuale_palletizzatore.pdf
The IP address of node red is

I try to use a template node with this code:

<!DOCTYPE html>
var manuale = function()
window.location.href = "";
<button onclick="manuale()">Visualizza</button>

But it doesn't work!

Why in your opinion?


I just read your post over again and spotted that the way you’re trying to access your file is incorrect. Node-RED (thankfully) doesn’t have access to arbitrary files inside the home folder of the user who runs it. You need to put it in the static files directory, then build the correct link for node-red. You should be able to find that by a forum search.

Old reply below:
Is your goal to display the PDF within the dashboard, or redirect to the file? If to redirect, use a link (<a href="Address here">) instead. If to embed, take a look at pdfjs, a Mozilla library that is a PDF viewer written fully in HTML5


first of all many thanks for reply.

My problem is that the PDF file must be located inside NodeRed machine in home/www/cpt/manuali
and I can not understand how write the correct code in JavaScript.

Keep in mind that if I use the same code in a Raspberry configuration all works well.
In my opionion is a problem of NodeRed or Linux configuration that not grant the correct access to the home/www/cpt/manuali but I cannot understand how.


On what port is node-red running?

Take a look at this thread: How to enable ability to input local image files in to node red dashboard

Port is the standard 1880

In that case one of the reasons it doesn’t work is that you’re trying to show the file from port 80 and just hope it works. Is there a webserver running on your device exposing everything in your home folder? If the answer is no which I do hope, check the link from my previous message and try that approach as it is the recommended way.

Ok solved!

I install Apache Web Server and now web server function well.


I bolded a part of my previous answer. Running a separate web server is not a good nor secure solution for your issue if you expose your entire home directory to it. Node-RED is in a way a webserver, and setting up the static files folder does exactly what you need.