doc88图片下载

先加载图片,然后打开浏览器控制台

// 查询所有div标签
let divs = document.querySelectorAll('div');
let imgCanvas = document.querySelector('#pageContainer').querySelectorAll('.inner_page');
// 所有div标签的display更改为None
divs.forEach(div => {
   div.style.display = 'None';
});
// 创建新div标签并将所有canvas插入
let newDiv = document.createElement('div');
imgCanvas.forEach(canvas => {
   newDiv.appendChild(canvas);
});
document.body.appendChild(newDiv);
// 页面打印
window.print();

原创力文档

let divs = document.querySelectorAll('div');
let imgView = document.querySelectorAll('.webpreview-item');
// 所有div标签的display更改为None
divs.forEach(div => {
   div.style.display = 'None';
});
// 创建新div标签并将所有canvas插入
let newDiv = document.createElement('div');
imgView.forEach(view => {
   newDiv.appendChild(view);
   view.style.display = 'block';
});
document.body.appendChild(newDiv);
// 页面打印
window.print();
let divs = document.querySelectorAll('div');
let imgCanvas = document.querySelectorAll('.creader-canvas');
document.head.remove();
for (var i = 0; i < divs.length; i++) divs[i].style.display = "None";
let newDiv = document.createElement('div');
for (var i = 0; i < imgCanvas.length; i++) {
    imgCanvas[i].setAttribute("style", "width: 1067px; height: 1508.1px;");
    newDiv.appendChild(imgCanvas[i]);
}
document.body.appendChild(newDiv);
posted @ 2024-02-28 23:00  wstong  阅读(33)  评论(0编辑  收藏  举报