提取属性 / 元数据

The Documentize PDF Extractor for .NET 简化了从 PDF 文档中提取元数据的过程。
可供您使用的属性包括:标题、作者、主题、关键字、页数。

How to Extract Metadata from PDF file

示例演示了如何从 PDF 文件中提取属性(标题、作者、主题、关键字、页数)。
要从 PDF 文档中提取元数据,请按照以下步骤操作:

  1. 创建 ExtractPropertiesOptions 实例以配置提取选项和输入 PDF 文件。
  2. 调用 PdfExtractorExtract 方法进行提取。
  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;

How to Extract Metadata from PDF stream

您可以自行决定如何打开流。

 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;

How to Extract Metadata from PDF file in the shortest possible style

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

Key Features:

  • Available metadata: Title, Author, Subject, Keywords, Number of Pages.
 中文