利用itextsharp删除Spire的水印

 

    using System.IO;
    using iTextSharp.text.pdf;

        /// 
        /// 使用第三方插件 =》 去除  Evaluation Warning : The document was created with Spire.PDF for .NET.
        /// 
        /// 原文件地址
        /// 生成后的文件地址
        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();
        }

你可能感兴趣的:(利用itextsharp删除Spire的水印)