zoukankan      html  css  js  c++  java
  • 利用itextsharp删除Spire的水印

        using System.IO;
        using iTextSharp.text.pdf;
    
            /// <summary>
            /// 使用第三方插件 =》 去除  Evaluation Warning : The document was created with Spire.PDF for .NET.
            /// </summary>
            /// <param name="sourcePdfs">原文件地址</param>
            /// <param name="outputPdf">生成后的文件地址</param>
            private void ClearPdfFilesFirstPage(string sourcePdf, string outputPdf)
            {
                PdfReader reader = null;
                iTextSharp.text.Document document = new iTextSharp.text.Document();
                PdfImportedPage page = null;
                PdfCopy pdfCpy = null;
                int n = 0;
                reader = new PdfReader(sourcePdf);
                reader.ConsolidateNamedDestinations();
                n = reader.NumberOfPages;
                document = new iTextSharp.text.Document(reader.GetPageSizeWithRotation(1));
                pdfCpy = new PdfCopy(document, new FileStream(outputPdf, FileMode.Create));
                document.Open();
                for (int j = 2; j <= n; j++)
                {
                    page = pdfCpy.GetImportedPage(reader, j);
                    pdfCpy.AddPage(page);
    
                }
                reader.Close();
                document.Close();
            }
  • 相关阅读:
    day15 web框架和Django基础
    activiti5.22 获得mybatis sessionFactory
    activiti 视图
    activiti 任意退
    spring cloud &&spring boot
    JPA 一对多关联
    webstorm 快捷键
    web storm 破解
    Excel通用导出
    activiti 小计
  • 原文地址:https://www.cnblogs.com/JioNote/p/12145779.html
Copyright © 2011-2022 走看看