当前位置: 移动技术网 > IT编程>开发语言>.net > .net Aspose.pdf 转html 去除版权

.net Aspose.pdf 转html 去除版权

2018年12月20日  | 移动技术网IT编程  | 我要评论

qq秀tnt,感悟珍珠港阅读答案,香港奇案实录雨夜屠夫

时光偷走的,永远都是我们眼皮底下看不见的珍贵。

 

1、 资源文件

  a)     aspose.pdf.18.12.0.nupkg  

     链接:https://pan.baidu.com/s/171_owofi5bqyky5jvc06aw   提取码:vpxi

  b)     aspose官网下载比较慢,未知原因

  c)     nuget安装不了,应该是被墙了

  d)     具体离线安装方式自行百度 

2、 解决问题

  a)      pdf转换html后去除版权

3、 提供思路

  a)      转换完成后版权信息在html中显示,我们可以通过读取html文件流的方式,将html中版权文字替换成空格。

4、 代码编写

public bool removecopyright(string filepath)
        {
            try
            {
                stream mystream = new filestream(filepath, filemode.open);
                encoding encode = system.text.encoding.getencoding("utf-8");
                streamreader mystreamreader = new streamreader(mystream, encode);
                string strhtml = mystreamreader.readtoend();
                string stroutput = strhtml.replace("evaluation only. created with aspose.pdf. copyright 2002-2018 aspose pty ltd. ", " ");
          // evaluation……pty ltd.是对应的版权文字,可以根据实际进行替换。
                mystream.seek(0, seekorigin.begin);
                mystream.setlength(0); 
                streamwriter sw = new streamwriter(mystream, encode);
                sw.write(stroutput);
                sw.flush();
                sw.close();
                mystream.close();
            }
            catch (exception)
            {
                return false;
            }
            return true;
        }

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网