# Newbie - Show PDF in Dashboard

**URL:** https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003
**Category:** Dashboard
**Created:** [10 December 2019 19:05 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003 "2019-12-10T19:05:15Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![roberto.zeni](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/roberto.zeni/32/3226_2.png) [@roberto.zeni](https://discourse.nodered.org/u/roberto.zeni)
#### Post date: [10 December 2019 19:05 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/1 "2019-12-10T19:05:15Z")

</div>

Hi,

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 192.168.99.2

I try to use a template node with this code:

```auto
<!DOCTYPE html>
<html>
<title>Manuale</title>
<body>
<script>
var manuale = function()
{
window.location.href = "http://192.168.99.2/Manuali/Manuale_palletizzatore.pdf";
}
</script>
<button onclick="manuale()">Visualizza</button>
</body>
</html>

```

But it doesn't work!

Why in your opinion?

Thanks

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [11 December 2019 10:37 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/2 "2019-12-11T10:37:15Z")

</div>

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

> **[mozilla/pdf.js](https://github.com/mozilla/pdf.js)**
>
> PDF Reader in JavaScript. Contribute to mozilla/pdf.js development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![roberto.zeni](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/roberto.zeni/32/3226_2.png) [@roberto.zeni](https://discourse.nodered.org/u/roberto.zeni)
#### Post date: [11 December 2019 11:29 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/3 "2019-12-11T11:29:43Z")

</div>

Hi,

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.

Thanks

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [11 December 2019 11:48 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/4 "2019-12-11T11:48:43Z")

</div>

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](https://discourse.nodered.org/t/how-to-enable-ability-to-input-local-image-files-in-to-node-red-dashboard/3085)

---

<div class="post-metadata">

### Author: ![roberto.zeni](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/roberto.zeni/32/3226_2.png) [@roberto.zeni](https://discourse.nodered.org/u/roberto.zeni)
#### Post date: [11 December 2019 12:15 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/5 "2019-12-11T12:15:33Z")

</div>

Port is the standard 1880

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [11 December 2019 12:30 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/6 "2019-12-11T12:30:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![roberto.zeni](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/roberto.zeni/32/3226_2.png) [@roberto.zeni](https://discourse.nodered.org/u/roberto.zeni)
#### Post date: [11 December 2019 18:05 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/7 "2019-12-11T18:05:30Z")

</div>

Ok solved!

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

Thanks

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [11 December 2019 21:16 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/8 "2019-12-11T21:16:39Z")

</div>

> [@roberto.zeni](#):
>
> Ok solved!
> 
> I install Apache Web Server and now web server function well.

> [@afelix](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![Kimo](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@Kimo](https://discourse.nodered.org/u/Kimo)
#### Post date: [19 October 2022 08:29 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/9 "2022-10-19T08:29:05Z")

</div>

Hi,  
I put my pdf file inside nodered static folder, then I use button node to open the file but no working. Am I doing it wrongly?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/1/41419b37a2e7bb2eb5002bf7bcdbbb52f99be967.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/7/57efed06a6d9f9a3ec161eb3ca1d705868b4f4d2.png)

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [9 November 2022 12:24 UTC](https://discourse.nodered.org/t/newbie-show-pdf-in-dashboard/19003/10 "2022-11-09T12:24:00Z")

</div>

Yes, please take a look at post #4 in this thread. On top of that, you cannot use absolute paths to somewhere on your harddrive in an `a href`, but you have to point to a web address relative to the static folder for the node red web server to see it.

Beyond that remains the same question as I posted to the first poster of this thread, are you trying to embed the PDF file, or show a link to it? If you’re trying to display it as link your current method should work once you change the path. For embedding/showing the pdf within the dashboard, this won’t be enough.
