---
schema_version: "1"
id: 9bf6278377b85dede468cf29ae0990118dd43fe087d767741eac0c534a230120
title: Export to PDF
collection: tableau
version: current
locale: en-us
portal_url: https://docs.salesforce.com/tableau/current/en-us/api/js_api/JavaScriptAPI/js_api_sample_export_to_pdf.md
canonical_url: https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_export_to_pdf.htm
source_site: help.tableau.com
content_type: documentation
content_hash: ecac511b1f0eb4d165f542f6c7cfb6358a0f12771d6d12599080c69d736a020d
description: Important changes for the Tableau JavaScript API
---
[Skip to main content](#main-content)

# Export

**Important changes for the Tableau JavaScript API**

As of February 2024, the Tableau JavaScript API is deprecated. Use the Embedding API v3 instead for embedding interactive views into web pages and applications. For guidance on embedding Tableau views, see the [Tableau Embedding API v3 Help](https://help.tableau.com/current/api/embedding_api/en-us/index.html).

Export the current visualization. This sample show how you can export the visualization in different formats: as a PDF file, as an image file, as a CSV file, as an Excel file, or as a PowerPoint file. You can also open the Download dialog box to let the user choose.

Export to PDF Export to Excel Export to CSV Export to Image Export to PowerPoint Show Download Dialog

  

* * *

  

```
<!DOCTYPE html>
<html>

<head>
    <title>Export</title>

    <script type="text/javascript"
        src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>
    <script type="text/javascript">
        var viz;

        function initViz() {
            var containerDiv = document.getElementById("vizContainer"),
                url = "http://public.tableau.com/views/RegionalSampleWorkbook/Obesity",
                options = {
                    hideTabs: true
                };

            viz = new tableau.Viz(containerDiv, url, options);
            // Create a viz object and embed it in the container div.
        }

        // Opens the Download to PDF dialog box
        function exportToPDF() {
            viz.showExportPDFDialog();
        }

		// Opens the Download Crosstab dialog box
        function exportToCSV() {
            viz.showExportCrossTabDialog();
        }

		// Downloads the crosstab data in an Excel file
        function exportToExcel() {
            viz.exportCrossTabToExcel();
        }

		// Opens the Download Image dialog box
        function exportImage() {
            viz.showExportImageDialog();
        }

		// Opens the Download PowerPoint dialog box
        function exportPowerPoint() {
            viz.showExportPowerPointDialog();
        }
 		// Opens the Download dialog box
        function showDownloadDialog() {
                viz.showDownloadDialog();
        }


    </script>
</head>

<body onload="initViz();">
    <div id="vizContainer"></div>
    <button onclick="exportToPDF();">Export to PDF</button>
    <button onclick="exportToCSV();">Export to CSV</button>
    <button onclick="exportToExcel();">Export to Excel</button>
    <button onclick="exportImage();">Export as Image</button>
    <button onclick="exportPowerPoint();">Export to PowerPoint</button>
    <button onclick="showDownloadDialog();">Show Download Dialog</button>
</body>

</html>
```