解决CSDN文档打印排版混乱问题

打印CSDN文章时候,总会出现一些广告和多余的信息,可以执行以下脚本信息去除:

(function () {

$("#side").remove();

$("#comment_title, #comment_list, #comment_bar, #comment_form, .announce, #ad_cen, #ad_bot").remove();

$(".nav_top_2011, #header, #navigator").remove();

$(".csdn-side-toolbar,.template-box,.reward-user-box").remove();

$(".p4course_target, .comment-box, .recommend-box, #csdn-toolbar, #tool-box,#dmp_ad_58").remove();

$("aside").remove();

$(".tool-box").remove();

$("main").css('display', 'content');

$("main").css('float', 'left');

$("#mainBox").css('width', '1048px');

$("#mainBox").css('margin-left', '0px');

$("#mainBox").css('margin-right', '0px');

$(".main_father.clearfix.d-flex.justify-content-center").css("width", "1048px");

$(".left-toolbox").remove();

$("asideNewNps").remove();

$(".aside-content").remove();
document.getElementById('recommendNps').remove();

$(".blog-footer-bottom").remove();

$("tool-box").remove();

// window.print();
})();

执行步骤:在需要打印的CSDN网页中调用开发者模式F12,然后点击console,把这段代码输入进去,按下enter即可开始打印。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_37247026/article/details/129545504