Scripting

Change PDF/Image

In Peakboard applications, you can display images and PDFs. If desired, these can be dynamically adjusted via a script.

Changing PDF/Image

To display a PDF or image, you need the corresponding control (PDF/Image). Use in scripts must be activated for this and a name must be assigned.

Additionally, various image or PDF resources are necessary. If needed, a resource can be initially assigned to the control. Subsequently, you can switch between different resources.

This function is available both through Peakboard Building Blocks and standard Lua scripting.

Building Blocks

Building Blocks PDF change

The screenshot shows the Building Blocks for changing the PDF resource. Specifically, the command to set the new resource is seen in the purple-colored block: set source of PDF_Control in Screen1 to 'Demo_PDF.pdf'. Here, Demo_PDF.pdf is the name of the new resource to be used.

In this example, two PDFs are alternately swapped. A variable tracks the currently displayed PDF (1 or 2). An enclosing IF statement checks this variable, switches to the other PDF resource accordingly, and updates the variable’s value.

Lua Code

The lower part of the screenshot shows the corresponding Lua code. Lines 2 and 5 demonstrate setting the new resource using the resource name.

The remaining lines describe the variable check and the switching of the currently used resource.

PDF/Image Control

The example described above for PDFs works similarly for images. Instead of the PDF control, an image control is used. Likewise, image resources are required instead of PDF resources.

We are learning from you!

Did you find this article helpful?

Be enlightened!

Do you need more support?

Peakboard Youtube icon Visit our YouTube channel

Our numerous videos for beginners and advanced users explain exactly how to design your dashboard.

Peakboard Templates icon Visit the Peakboard Templates

Download our templates for various use cases for free.

Peakboard icon Visit www.peakboard.com

Find out all about Peakboard and browse our different use cases and success stories.