csharp 例如-CSHARP-GroupDocs.Text.Examples.CSharp-DocumentTextExtractor-ExtractTextFromPdfPortfolios.c

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 例如-CSHARP-GroupDocs.Text.Examples.CSharp-DocumentTextExtractor-ExtractTextFromPdfPortfolios.c相关的知识,希望对你有一定的参考价值。

//get file actual path
String filePath = Common.getFilePath(fileName);
// Create an extractor factory 
var factory = new ExtractorFactory();
// Create an instance of PdfTextExtractor class 
var extractor = new PdfTextExtractor(filePath);
//Set extraction mode to Fast text extraction
extractor.ExtractMode = ExtractMode.Simple; 
// Iterate over all files in the portfolio 
for (var i = 0; i < extractor.Entities.Count; i++)
{
  // Print the name of a file   
  Console.WriteLine(extractor.Entities[i].Name);
  // Open the stream of a file   
  using (var stream = extractor.Entities[i].OpenStream())
  {
      // Create the text extractor for a file     
      var entityExtractor = factory.CreateTextExtractor(stream);
      // If a media type is supported
      if (entityExtractor != null) 
      try
      {
        // Print the content of a file       
        Console.WriteLine(entityExtractor.ExtractAll());
      }
      finally
      {
        entityExtractor.Dispose();
      }
  }
}

以上是关于csharp 例如-CSHARP-GroupDocs.Text.Examples.CSharp-DocumentTextExtractor-ExtractTextFromPdfPortfolios.c的主要内容,如果未能解决你的问题,请参考以下文章

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,AddDocumentToIndex.cs

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,AddDocumentToIndexAsynchronously.cs

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,CreateIndexInMemory.cs

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,CreateIndexOnDisk.cs

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,CreateWithOverwritingExistedIndex.cs

csharp 例如-CSHARP-GroupDocs.Search.Examples.CSharp索引,CustomExtractor.cs