如何将base64 in 1 PDF与JS打印?

时间:2018-10-12 19:23:55

标签: javascript jquery pdf printing base64

有人帮我吗?

我有JS退货: enter image description here

我想要加入一个PDF,但是printWindow.document.write()无法正常工作: enter image description here

函数在许多窗口中划分。

这是我的方法:

abrirPopUpComBase64: (function(popup) {
        var winparams = 'dependent=yes,locationbar=no,scrollbars=yes,menubar=yes,resizable,screenX=50,screenY=50,width=850,height=1050';

        if (!validacao.dadoVazioOuNulo(popup.bases64)) {
            var objbuilder = [];

            for (var i = 0, l = popup.bases64.length; i < l; i++) {
                var base64 = popup.bases64[i];
                objbuilder.push('<object width="100%" height="100%" data="data:application/pdf;base64,' + base64 + '" type="application/pdf" class="internal">');
                objbuilder.push('<embed src="data:application/pdf;base64,' + base64 + '" type="application/pdf" />');
                objbuilder.push('</object>');
            }

            var title = popup.title;
            if (!validacao.dadoVazioOuNulo(title)) {
                title = '';
            }

            var printWindow = window.open(title, 'PDF', winparams);
            if (!validacao.jsonVazioOuNulo(printWindow)) {
                printWindow.document.write(objbuilder);
            } else {
                $.smallBox({
                    title : "Aten\u00e7\u00e3o",
                    content : "<i class='fa fa-exclamation-triangle'></i> <i>N\u00e3o ser\u00e1 poss\u00edvel abrir a janela de impress\u00e3o, verifique se o bloqueio de pop-up do seu navegador est\u00e1 ativado.</i>",
                    color : "#C46A69",
                    iconSmall : "fa fa-times fadeInRight animated",
                    timeout : 10000
                });
            }
        }
    }),

0 个答案:

没有答案