Skip to content

Commit

Permalink
window parameter in open and print method (issue #587)
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 committed Apr 2, 2017
1 parent 86f34d3 commit 5f4076f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/browser-extensions/pdfMake.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ Document.prototype._openWindow = function () {
return win;
};

Document.prototype._openPdf = function (options) {
var win = this._openWindow();
Document.prototype._openPdf = function (options, win) {
if (!win) {
win = this._openWindow();
}
try {
this.getBlob(function (result) {
var urlCreator = window.URL || window.webkitURL;
Expand All @@ -109,19 +111,21 @@ Document.prototype._openPdf = function (options) {
}
};

Document.prototype.open = function (options) {
Document.prototype.open = function (options, win) {
options = options || {};
options.autoPrint = false;
win = win || null;

this._openPdf(options);
this._openPdf(options, win);
};


Document.prototype.print = function (options) {
Document.prototype.print = function (options, win) {
options = options || {};
options.autoPrint = true;
win = win || null;

this._openPdf(options);
this._openPdf(options, win);
};

Document.prototype.download = function (defaultFileName, cb, options) {
Expand Down

0 comments on commit 5f4076f

Please sign in to comment.