CSDN completely exports pdf blog content, removes redundancy, and only keeps blog

This article is fully referenced from other blogs:

        Convert new CSDN articles to PDF, print (remove blank) - IT said blog - CSDN blog

        How to export CSDN articles to pdf? _My blog house-CSDN blog_csdn export pdf

After the original blog code is executed, the blog author column is retained:

This article refers to another blog and adds the code to remove the author column. 

The effective time for verification of this article is October 24, 2021.

1. Instructions for use:

I use the latest Edge browser:

                

2. Specific operation method:

1. Fn+F12 to open the browser developer tools, click on the console:

2. Enter the following code in the console (English version is console):

(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();
	$("#toolBarBox").remove();
    $("main").css('display','content');
    $("main").css('float','left');
    $("#mainBox").css('width','100%');     
    $(".main_father.clearfix.d-flex.justify-content-center").css("width","100%"); //显示不全关键在于修改这里的width的比例
    window.print();																  // 修改成 90% 基本就可以显示全
})();

Then type enter.

3. Results

If the blog picture is too wide and the page size is not enough, you can set the printing paper size, click on to show more settings , select None for \rightarrowmargin\rightarrow 

Guess you like

Origin blog.csdn.net/leiconghe/article/details/120934910