diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 8f235e888d7a658af0c0b6a09301f97f0f0f6890..dc1a286d757bac34113bede2506cfa53eac12b5a 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -6562,7 +6562,7 @@ var hiprint = function (t) { i = e; if (t && t.length) { - var o = $(''); + var o = $(''); i || (i = o).addClass("hicontextmenuroot"), $.each(t, function (t, e) { var i = !!e.disable && e.disable(), r = $('
  • ' + (e.text || "") + "
  • "); @@ -8797,7 +8797,8 @@ var hiprint = function (t) { }); }, t.prototype.toPdf = function (t, e, n) { var i = this; - + var dtd = $.Deferred(); + var isDownload = true; if (this.printPanels.length) { var r = o.a.mm.toPt(this.printPanels[0].width), a = o.a.mm.toPt(this.printPanels[0].height), @@ -8814,6 +8815,9 @@ var hiprint = function (t) { format: this.printPanels[0].paperType ? this.printPanels[0].paperType.toLocaleLowerCase() : [r, a] }), l = this.getHtml(t, n); + if(n.hasOwnProperty("isDownload")){ + isDownload = n.isDownload + } this.createTempContainer(); var u = this.getTempContainer(); this.svg2canvas(l), u.html(l[0]); @@ -8825,10 +8829,17 @@ var hiprint = function (t) { for (var o = t.toDataURL("image/jpeg"), p = 0; p < d; p++) { s.addImage(o, "JPEG", 0, 0 - p * a, r, d * a), p < d - 1 && s.addPage(); } - - i.removeTempContainer(), e.indexOf(".pdf") > -1 ? s.save(e) : s.save(e + ".pdf"); + if(isDownload){ + i.removeTempContainer(),e.indexOf(".pdf") > -1 ? s.save(e) : s.save(e + ".pdf"); + } else{ + i.removeTempContainer(); + var pdfFile = s.output('blob'); + //var file = new File([pdfFile], e.name.indexOf(".pdf") > -1 ? e.name : e.name + ".pdf", {type: 'application/pdf', lastModified: Date.now()}); + dtd.resolve(pdfFile); + } }); } + return dtd.promise(); }, t.prototype.createTempContainer = function () { this.removeTempContainer(), $("body").prepend($('
    ')); }, t.prototype.removeTempContainer = function () {