Skip to Content

How to Download PDF in One-click from Tableau

Blog | March 2, 2019 | By Jayaprakash Sivanandam

Tableau’s fantastic at taking data and giving users highly immersive and dynamic visualizations – it’s what we love it for. Whether it’s Tableau Desktop or Tableau Server, users across industries are extremely pleased with Tableau’s and all that it has to offer.

“A workbook is no longer a simple paperback reader but a highly sophisticated, accurate, and dynamic representation of specific data.”

Dashboards have become almost synonymous when it comes to building a successful modern-day enterprise. From KPI’s to forecasts, and helping business managers make better decisions – how today’s teams function across departments has only further pushed their reliance on these dashboards.

In this blog, we will be focusing on one such specific requirement that most Tableau users and clients look for i.e., the ability to generate their Tableau Dashboard into a PDF File Download. Whether it’s a bar chart you need for that PowerPoint Presentation, or you have to simply document work and need require something as simple and a page number to your downloaded PDF file- Tableau users need to be able to download their visualizations.

Generating your Interactive Dashboards into a Downloadable PDF File

Downloading visualizations to a PDF Document / Image is one of the most common features requested by users I work with. Tableau realizing this has an extremely useful built-in feature for users to download their visualizations. However, there are several cases when a Tableau PDF download feature doesn’t come in handy.

For instance, the download feature at times leaves users bewildered as to how exactly they need to go about to download a PDF. At times the necessary steps you need to follow are not fully understood by all business intelligence users.

So, we’ve got a great built-in feature that can help to download Tableau dashboard as PDF. But it’s just going to take some getting used to. If only there was a way where we could do something that helps in simplifying the process to just click a button and have our PDF ready for download.

Where users are given a single click feature and voila! Something easy, and not very complex to implement – where it wouldn’t take an engineer to implement. But what was most important was we needed the solutions to be reusable in other workbooks or by anyone who has access to Tableau Server.

Tableau PDF download in just One Click!

Let’s discuss step-by-step on how you can download PDF in just a single click.

What we first need to understand is that the only way to print a worksheet from a Tableau dashboard running on Tableau Server is to use the download button in the toolbar. While Tabcmd or REST API does allow PDF export, implementing the same needs a bit of programming background and is often used in automating tasks. 

Another way to print only a sheet or dashboard would be to publish the sheet separately to the Server and use Tableau’s built-in feature to convert the view to PDF. It’s simple, all you need is to pass .pdf at end of the view URL or pass query parameter: format=pdf and you get PDF view.

Now that we know how to allow PDF download from Tableau Server, we can further leverage this by adding a PDF icon to the dashboard and pointing it to the Tableau Server URL containing the view and appending “.pdf” to the URL. Once a user clicks on the PDF icon, they will immediately have the PDF Document in a ready-to-print format. Ok, that makes things simpler, but this is still not a single click download, users need to navigate to another page and must manually download the PDF. 

Let’s discuss how to download visualizations when users click on the icon, instead of them being navigated to a new tab. I have leveraged simple HTML & JavaScript code that allows users to download a PDF link by simply clicking on it. 

Below is a sample HTML file used for downloading PDF. I am not explaining the HTML file, it is something that can be used with very less or no modification.

<!DOCTYPE html>  
    <title> export to PDF </title>  
    <script type="text/javascript">  
        printfun = function(){  
            var url = window.parent.location.pathname;  
            var paramval = GetParameterValues('id');  
                var srcurl = window.parent.location.protocol + '//' + window.parent.location.hostname + paramval + '.pdf?';  
                var srcurl = window.parent.location.protocol + '//' + window.parent.location.hostname + window.parent.location.pathname + '.pdf?';  
            var req = new XMLHttpRequest();  
  "GET", srcurl, true);  
            req.responseType = "blob";  
            req.onload = function (event) {  
                var blob = req.response;  
                var link = document.createElement("a");  
                link.href = window.URL.createObjectURL(blob);  
       = "new" + new Date() + ".pdf";  
                    if(navigator.userAgent.indexOf("MSIE") !== -1 || navigator.appVersion.indexOf("Trident/") > 0){ // IE  
                        console.log("IE type browser detected")  
                        window.navigator.msSaveBlob(blob, "new" + new Date() + ".pdf";  
                     } else{ // FF, Chrome  
                        console.log("Fire fox or Chrome detected");  
                        var event = document.createEvent("MouseEvents");  
                        event.initEvent("click", true, true);  
                }else if(document.createEventObject){ // no idea of browser type  
                    var evObj = document.createEventObject();  
                    link.fireEvent("onclick", evObj);  
                 }else { // For any case  
        function GetParameterValues(param) {    
            var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');    
            for (var i = 0; i < url.length; i++) {    
                var urlparam = url[i].split('=');    
                if (urlparam[0] == param) {    
                    return urlparam[1];    
        getTableau = function() {  
            return parent.parent.tableau;  
        getCurrentViz = function() {  
            return getTableau().VizManager.getVizs()[0];  
       getCurrentWorkbook = function() {  
            return getCurrentViz().getWorkbook();  
        function initViz() {  
            tableau = getTableau();
            workbook = getCurrentWorkbook();  
            viz = getCurrentViz();  
    <button id="myBtn" onclick="printfun();">print</button>  

Note: Tableau doesn’t allow embedding of code directly into the dashboard, hence the HTML file should be published as webdataconnector (WDC) and used in dashboards.

Here is a reference link for importing webdataconnector into the dashboard.

Once imported and added to the workbook, as the last step, edit WDC URL and add the URI of the sheet published separately to Tableau Server.

That’s it! I hope this read has proved useful – feel free to reach out to if you’ve got any queries on how you can download PDF from Tableau in just a Single Click.

author image
Jayaprakash Sivanandam
Back to top