From 3a9327f01dbd879b7b4a439612ed1bed340ca1e3 Mon Sep 17 00:00:00 2001 From: Paul Lambert Date: Mon, 9 Mar 2015 14:23:37 +1300 Subject: [PATCH] Fix(exporter): fix #2921 download rather than open pdf in IE --- misc/tutorial/206_exporting_data.ngdoc | 4 ++++ src/features/exporter/js/exporter.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/misc/tutorial/206_exporting_data.ngdoc b/misc/tutorial/206_exporting_data.ngdoc index 1daedb0328..dbcbf623fb 100644 --- a/misc/tutorial/206_exporting_data.ngdoc +++ b/misc/tutorial/206_exporting_data.ngdoc @@ -16,6 +16,10 @@ the grid menu using the gridOption `enableGridMenu` Note that the option to export selected data is only visible if you have data selected. +If you are using internet explorer then the pdf will automatically download rather than opening, +there are issues with pdfMake not being able to automatically open tabs in internet explorer +(refer https://github.com/bpampuch/pdfmake/issues/16 and other issues in that repo). + @example In this example we use the native grid menu buttons, and we show both the pdf and csv export options. diff --git a/src/features/exporter/js/exporter.js b/src/features/exporter/js/exporter.js index dbe655367b..3c0ce0a9c2 100644 --- a/src/features/exporter/js/exporter.js +++ b/src/features/exporter/js/exporter.js @@ -842,7 +842,11 @@ var exportData = this.getData(grid, rowTypes, colTypes); var docDefinition = this.prepareAsPdf(grid, exportColumnHeaders, exportData); - pdfMake.createPdf(docDefinition).open(); + if (this.isIE()) { + pdfMake.createPdf(docDefinition).download(); + } else { + pdfMake.createPdf(docDefinition).open(); + } },