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

The Documentize PDF Extractor for .NET упрощает извлечение метаданных из PDF‑документов. Доступные свойства, которые могут вас заинтересовать: Title, Author, Subject, Keywords, 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 title = pdfProperties.Title;
6var author = pdfProperties.Author;
7var subject = pdfProperties.Subject;
8var keywords = pdfProperties.Keywords;
9var 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 numberOfPages = pdfProperties.NumberOfPages;

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

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

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

  • Доступные метаданные: Title, Author, Subject, Keywords, Number of Pages.
 Русский