var pdfReader = new PdfReader("xxx.pdf"); StreamWriter output = new StreamWriter(new FileStream("处理结果.txt", FileMode.Create)); int pageCount = pdfReader.NumberOfPages; for (int pg = 1; pg <= pageCount; pg++) { ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy(); var value = PdfTextExtractor.GetTextFromPage(pdfReader, pg, strategy); value = value.Replace(" ", ""); Console.WriteLine(value); output.Write(value); } output.Flush(); output.Close(); Console.Write("处理完毕"); Console.ReadLine(); https://www.cnblogs.com/New-HackerHK/p/14853693.html