Почему на экране печати появляется пустая страница, когда тег для вставки используется для PDF? - PullRequest
0 голосов
/ 23 декабря 2018

Я хочу напечатать PDF с использованием тега вставки.PDF появляется на экране, но на экране печати появляется пустая страница.Зачем?и как я могу это решить?

const width = window.innerWidth * 0.9;
const height = window.innerHeight * 0.9;
const content = `<!DOCTYPE html>
        <html>
        <head><title></title></head>
        <body onload="window.focus(); window.print(); window.close();">
        <embed width="720" height="540" src="https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" />
        </body>
        </html>`;
const options = 'toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=' + width + ',height=' + height;
const printWindow = window.open('', 'print', options);
printWindow.document.open();
printWindow.document.write(content);
printWindow.document.close();
printWindow.focus();
...