Exporting with Scroll Exporters from a Viewport

Thomas Rough
Last update: Feb 5, 2018

Using the code examples below, you can create a button to start exports from within your Viewport. For this recipe, we are going to use AUI dialogs as our UI – this depends on jQuery, but you are free to create or use any alternative.

If your theme does not declare the window.contextPath variable already, add this script tag in a .vm file. It must be evaluated before the JavaScript code from the next section.

<script>
window.contextPath = '$contextPath';
</script>

Implementing the code

The code below can be used in any <script> tag or in an external javascript file. Browser compatibility has been tested in IE9+, Firefox, Chrome and Safari.

Info

We use jQuery instead of the global $ variable so you can paste this code into a script tag in any vm file. The $ variable causes issues in vm files because of the Velocity syntax. If you put this in a separate JavaScript file feel free to use $ instead.