PDF Extractor

Извлечение текста

Точно извлекайте текст из PDF‑документов с помощью .NET‑инструментов Documentize — получайте, обрабатывайте и анализируйте содержимое без усилий.

Извлечение изображений

Без усилий извлекайте изображения из PDF‑документов изнутри приложений .NET

Извлечение свойств / Метаданных

Извлекайте метаданные из PDF точно с Documentize, используя C#/.NET

Экспорт данных формы

Извлечение и экспорт данных из PDF‑форм (AcroForms) в другие форматы, такие как CSV, с использованием C#/.NET

Подразделы PDF Extractor

Извлечение текста

The Documentize PDF Extractor for .NET упрощает извлечение текста из PDF‑документов. Независимо от того, нужен ли вам чистый, необработанный или простой текст, этот плагин позволяет эффективно извлекать текст, сохраняя форматирование или опуская его в зависимости от ваших требований.

Как извлечь текст из PDF‑файла

Чтобы извлечь текст из PDF‑файла, выполните следующие шаги:

  1. Создайте экземпляр ExtractTextOptions для указания пути к входному файлу.
  2. Запустите метод Extract для извлечения текста.
1// Create ExtractTextOptions object to set input file path
2var options = new ExtractTextOptions("path_to_your_pdf_file.pdf");
3// Perform the process and get the extracted text
4var textExtracted = PdfExtractor.Extract(options);

Как извлечь текст из PDF‑потока

Чтобы извлечь текст из PDF‑потока, выполните следующие шаги:

  1. Создайте экземпляр ExtractTextOptions для указания входного потока.
  2. Запустите метод Extract для извлечения текста.
1// Create ExtractTextOptions object to set input stream
2var stream = File.OpenRead("path_to_your_pdf_file.pdf");
3var options = new ExtractTextOptions(stream);
4// Perform the process and get the extracted text
5var textExtracted = PdfExtractor.Extract(options);

Режимы извлечения текста

**ExtractTextOptions** предлагает три режима извлечения, обеспечивая гибкость в зависимости от ваших потребностей.

  1. Pure Mode: Сохраняет оригинальное форматирование, включая пробелы и выравнивание.
  2. Raw Mode: Извлекает текст без форматирования, полезно для обработки необработанных данных.
  3. Flatten Mode: Представляет содержимое PDF в виде позиционных фрагментов текста с их координатами.
1// Create ExtractTextOptions object to set input file path and TextFormattingMode
2var options = new ExtractTextOptions("path_to_your_pdf_file.pdf", TextFormattingMode.Pure);
3// Perform the process and get the extracted text
4var textExtracted = PdfExtractor.Extract(options);

Как извлечь текст из PDF‑файла в максимально короткой форме

1// Perform the process and get the extracted text
2var textExtracted = PdfExtractor.Extract(new ExtractTextOptions("path_to_your_pdf_file.pdf", TextFormattingMode.Pure));

Ключевые особенности:

  • Pure Mode: Извлекает текст, сохраняющий оригинальное форматирование.
  • Raw Mode: Извлекает текст без какого‑либо форматирования.
  • Flatten Mode: Извлекает текст без специальных символов и форматирования.

Извлечение изображений

The Documentize PDF Extractor for .NET plugin enables you to effortlessly extract images from PDF documents. It scans your PDF files, identifies embedded images, and extracts them while maintaining their original quality and format. This tool enhances the accessibility of visual content and streamlines the process of retrieving images from PDFs.

Как извлечь изображения из PDF

Чтобы извлечь изображения из PDF‑файла, выполните следующие шаги:

  1. Создайте экземпляр класса ExtractImagesOptions.
  2. Добавьте путь к входному файлу в параметры с помощью метода AddInput.
  3. Укажите путь к каталогу вывода для изображений с помощью метода AddOutput.
  4. Выполните процесс извлечения изображений с помощью плагина.
  5. Получите извлечённые изображения из контейнера результата.
 1// Create ExtractImagesOptions to set instructions
 2var options = new ExtractImagesOptions();
 3// Add input file path
 4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
 5// Set output Directory path
 6options.AddOutput(new DirectoryData("path_to_results_directory"));
 7// Perform the process
 8var results = PdfExtractor.Extract(options);
 9// Get path to image result
10var imageExtracted = results.ResultCollection[0].ToFile();

Извлечение изображений из PDF‑файла в потоки без папки

The PdfExtractor plugin supports saving to streams, which allows you to extract images from PDF files into streams without using temporary folders.

 1// Create ExtractImagesOptions to set instructions
 2var options = new ExtractImagesOptions();
 3// Add input file path
 4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
 5// Not set output - it will write results to streams
 6// Perform the process
 7var results = PdfExtractor.Extract(options);
 8// Get Stream
 9var ms = results.ResultCollection[0].ToStream();
10// Copy data to file for demo
11ms.Seek(0, SeekOrigin.Begin);
12using (var fs = File.Create("test_file.png"))
13{
14    ms.CopyTo(fs);
15}

Ключевые особенности:

  • Извлечение встроенных изображений: определение и извлечение изображений из PDF‑документов.
  • Сохранение качества изображений: обеспечивает сохранение оригинального качества извлечённых изображений.
  • Гибкий вывод: сохранение извлечённых изображений в желаемом формате или месте.

Извлечение свойств / Метаданных

The Documentize PDF Extractor для .NET упрощает извлечение метаданных из PDF‑документов.
Доступные свойства, которые могут вас заинтересовать: FileName, Title, Author, Subject, Keywords, Created, Modified, Application, PDF Producer, Number of Pages.

Как извлечь метаданные из PDF‑файла

В примере показано, как извлечь свойства (Title, Author, Subject, Keywords, Number of Pages) из PDF‑файла.
Чтобы извлечь метаданные из PDF‑документа, выполните следующие шаги:

  1. Создайте экземпляр ExtractPropertiesOptions для настройки параметров извлечения и указания входного PDF‑файла.
  2. Вызовите метод Extract класса PdfExtractor для извлечения метаданных.
  3. Получите извлечённые свойства через PdfProperties.
 1// Create ExtractPropertiesOptions object to set input file
 2var options = new ExtractPropertiesOptions("path_to_your_pdf_file.pdf");
 3// Perform the process and get Properties
 4var pdfProperties = PdfExtractor.Extract(options);
 5var filename = pdfProperties.FileName;
 6var title = pdfProperties.Title;
 7var author = pdfProperties.Author;
 8var subject = pdfProperties.Subject;
 9var keywords = pdfProperties.Keywords;
10var created = pdfProperties.Created;
11var modified = pdfProperties.Modified;
12var application = pdfProperties.Application;
13var pdfProducer = pdfProperties.PdfProducer;
14var numberOfPages = pdfProperties.NumberOfPages;

Как извлечь метаданные из PDF‑потока

Вы можете открыть поток по своему усмотрению.

 1// Create ExtractPropertiesOptions object to set input stream
 2var stream = File.OpenRead("path_to_your_pdf_file.pdf");
 3var options = new ExtractPropertiesOptions(stream);
 4// Perform the process and get Properties
 5var pdfProperties = PdfExtractor.Extract(options);
 6var title = pdfProperties.Title;
 7var author = pdfProperties.Author;
 8var subject = pdfProperties.Subject;
 9var keywords = pdfProperties.Keywords;
10var created = pdfProperties.Created;
11var modified = pdfProperties.Modified;
12var application = pdfProperties.Application;
13var pdfProducer = pdfProperties.PdfProducer;
14var numberOfPages = pdfProperties.NumberOfPages;

Как извлечь метаданные из PDF‑файла в самом коротком виде

1// Perform the process and get Properties
2var pdfProperties = PdfExtractor.Extract(new ExtractPropertiesOptions("path_to_your_pdf_file.pdf"));

Ключевые возможности:

  • Доступные метаданные: FileName, Title, Author, Subject, Keywords, Created, Modified, Application, PDF Producer, Number of Pages.

Экспорт данных формы

The Documentize PDF Extractor for .NET plugin provides a seamless way to extract and export data from PDF forms (AcroForms) into other formats like CSV. This dynamic tool simplifies the process of retrieving form field values, allowing for easy data management, transfer, and analysis.

How to Export Form Data from PDF to CSV

To export form data from a PDF to CSV, follow these steps:

  1. Create an instance of the ExtractImagesOptions class.
  2. Define export options using the FormExporterValuesToCsvOptions class.
  3. Add input PDF files and specify the output CSV file.
  4. Run the Extract method to perform the export.
1// Create ExtractFormDataToDsvOptions object to set instructions
2var options = new ExtractFormDataToDsvOptions(',', true);
3// Add input file path
4options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileData("path_to_result_csv_file.csv"));
7// Perform the process
8PdfExtractor.Extract(options);

How to Export Form Data from PDF to TSV

Use Tab as Delimiter.

 1// Create ExtractFormDataToDsvOptions object to set instructions
 2var options = new ExtractFormDataToDsvOptions();
 3//Set Delimiter
 4options.Delimiter = '\t';
 5//Add Field Names to result
 6options.AddFieldName = true;
 7// Add input file path
 8options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
 9// Set output file path
10options.AddOutput(new FileData("path_to_result_csv_file.tsv"));
11// Perform the process
12PdfExtractor.Extract(options);

Key Features:

  • Export Form Data: Extract data from PDF forms (AcroForms) into CSV or other formats.
  • Data Filtering: Use predicates to filter specific form fields for export based on criteria like field type or page number.
  • Flexible Output: Save exported data for analysis or transfer to spreadsheets, databases, or other document formats.
 Русский