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

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.
 Русский