# Refresh a Document Viewer

**URL:** <https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590>\
**Category:** Ignition\
**Created:** [June 7, 2012, 12:49pm UTC](https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590 "2012-06-07T12:49:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomt](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@tomt](https://forum.inductiveautomation.com/u/tomt)\
**Post date:** [June 7, 2012, 12:49pm UTC](https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590/1 "2012-06-07T12:49:18Z")

</div>

I have a document viewer with a touch of HTML to load an image from a website. Specifically, it loads a radar image from a weather site for display on digital signage. Once the window open it never closes - the project will run for extended periods.

My problem is it never refreshes the image. I’ve read the document viewer is pretty rudimentary, so I don’t know what I could do with HTML. I did try to close the window, but the client is still caching the image.

Any ideas?

---

<div class="post-metadata">

**Author:** ![tomt](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@tomt](https://forum.inductiveautomation.com/u/tomt)\
**Post date:** [June 7, 2012, 2:42pm UTC](https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590/2 "2012-06-07T14:42:45Z")

</div>

I’m going to answer my own question… It isn’t elegant but it works.

I have a client timer to run this code every so often. It reads the html from the document viewer control, sets it to nothing, then sets it back to the original code. Just rewriting the same value without setting it to something else doesn’t cause it to update, the data actually has to change for the control to update.

```auto
weather= system.gui.getWindow('Weather')
text = weatherwin.getRootContainer().getComponent('Document Viewer').text
weatherwin.getRootContainer().getComponent('Document Viewer').text = ""
weatherwin.getRootContainer().getComponent('Document Viewer').text = text
```

---

<div class="post-metadata">

**Author:** ![tomt](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@tomt](https://forum.inductiveautomation.com/u/tomt)\
**Post date:** [June 7, 2012, 2:51pm UTC](https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590/3 "2012-06-07T14:51:03Z")

</div>

This is the end result:

[viewtopic.php?p=26514#p26514](http://www.inductiveautomation.com/forum/viewtopic.php?p=26514#p26514)

---

<div class="post-metadata">

**Author:** ![dave.fogle](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dave.fogle](https://forum.inductiveautomation.com/u/dave.fogle)\
**Post date:** [June 7, 2012, 4:21pm UTC](https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590/4 "2012-06-07T16:21:21Z")

</div>

What you're doing sounds like the best way to go about it. You could make it even a little simpler by just setting the text back to itself. I don't believe you actually have to change the text at all.

`weatherwin= system.gui.getWindow('Weather')
text = weatherwin.getRootContainer().getComponent('Document Viewer').text 
weatherwin.getRootContainer().getComponent('Document Viewer').text = text`  
Is there a reason you're setting the text property instead of the Page URL property?

---

<div class="post-metadata">

**Author:** ![tomt](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@tomt](https://forum.inductiveautomation.com/u/tomt)\
**Post date:** [June 7, 2012, 4:32pm UTC](https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590/5 "2012-06-07T16:32:38Z")

</div>

I tried it as you suggested first. It actually needs to change. In this case, I don’t have a URL, I have some HTML I wrote by hand to display an image from another site. This resides in the text field of the control.

---

<div class="post-metadata">

**Author:** ![dave.fogle](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dave.fogle](https://forum.inductiveautomation.com/u/dave.fogle)\
**Post date:** [June 7, 2012, 4:33pm UTC](https://forum.inductiveautomation.com/t/refresh-a-document-viewer/4590/6 "2012-06-07T16:33:47Z")

</div>

I see. Well I'm glad you got it working.
