mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-09-15 09:24:52 +00:00
修复 pdf无法打印问题 修复pdf打印添加水印问题
This commit is contained in:
@@ -13883,8 +13883,12 @@ class PDFPrintService {
|
|||||||
const wrapper = document.createElement("div");
|
const wrapper = document.createElement("div");
|
||||||
wrapper.className = "printedPage";
|
wrapper.className = "printedPage";
|
||||||
wrapper.append(img);
|
wrapper.append(img);
|
||||||
|
|
||||||
|
// 关键:定义 pageSize 和 pageCount
|
||||||
|
const pageSize = this.pagesOverview[0];
|
||||||
|
const pageCount = this.pagesOverview.length;
|
||||||
|
|
||||||
var printWatermarkDiv = document.createElement('div');
|
var printWatermarkDiv = document.createElement('div');
|
||||||
// console.log(pageSize);
|
|
||||||
printWatermarkDiv.style.position = 'absolute';
|
printWatermarkDiv.style.position = 'absolute';
|
||||||
printWatermarkDiv.style.left = '0px';
|
printWatermarkDiv.style.left = '0px';
|
||||||
printWatermarkDiv.style.top = '0px';
|
printWatermarkDiv.style.top = '0px';
|
||||||
@@ -13893,11 +13897,8 @@ class PDFPrintService {
|
|||||||
watermarkObj(printWatermarkDiv, watermarkTxt);
|
watermarkObj(printWatermarkDiv, watermarkTxt);
|
||||||
wrapper.appendChild(printWatermarkDiv);
|
wrapper.appendChild(printWatermarkDiv);
|
||||||
this.printContainer.append(wrapper);
|
this.printContainer.append(wrapper);
|
||||||
const {
|
|
||||||
promise,
|
const { promise, resolve, reject } = Promise.withResolvers();
|
||||||
resolve,
|
|
||||||
reject
|
|
||||||
} = Promise.withResolvers();
|
|
||||||
img.onload = resolve;
|
img.onload = resolve;
|
||||||
img.onerror = reject;
|
img.onerror = reject;
|
||||||
promise.catch(() => {}).then(() => {
|
promise.catch(() => {}).then(() => {
|
||||||
|
|||||||
@@ -78,13 +78,6 @@
|
|||||||
}
|
}
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 水印初始化(保持原有逻辑)
|
|
||||||
window.onload = function () {
|
|
||||||
if (typeof initWaterMark === 'function') {
|
|
||||||
initWaterMark();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user