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(); }