How to print a neatly typed CSDN article? Teach you PDF one-click export

How to use: In the Chrome browser, press "Ctrl+Shift+I" to enter the developer tools, copy the following code to the console, and press Enter to print.

1. Automatically "read the full text"
2. Delete redundant information such as the top bar, sidebar, related article display, browsing information, advertisements, and likes. Really refreshing mode.
3. Automatic output print preview

(function(){
    
    
    'use strict';
    var articleBox = $("div.article_content");
    articleBox.removeAttr("style");
    $("#btn-readmore").parent().remove();
    $("#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, .more-toolbox, .article-info-box, .btn-readmore").remove();
    $("aside").remove();
    $(".tool-box").remove();
    $("main").css('display','content');
    $("main").css('float','left');
    $("#mainBox").css('width','100%');
    $(".main_father.clearfix.d-flex.justify-content-center").css("width","100%");
    window.print();
})();

The operation is as follows: the
Insert picture description here
effect is as follows:
Insert picture description here

Reference

gitee
https://www.cnblogs.com/jiangkejie/p/13221446.html

Guess you like

Origin blog.csdn.net/OuDiShenmiss/article/details/109261672