Trích xuất Thuộc tính / Siêu dữ liệu

The Documentize PDF Extractor for .NET giúp việc trích xuất Siêu dữ liệu từ các tài liệu PDF trở nên đơn giản. Các thuộc tính có sẵn mà bạn có thể quan tâm: Tiêu đề, Tác giả, Chủ đề, Từ khóa, Số trang.

Cách trích xuất Siêu dữ liệu từ tệp PDF

Ví dụ dưới đây minh họa cách Trích xuất Thuộc tính (Tiêu đề, Tác giả, Chủ đề, Từ khóa, Số trang) từ tệp PDF. Để trích xuất siêu dữ liệu từ một tài liệu PDF, thực hiện các bước sau:

  1. Tạo một thể hiện của ExtractPropertiesOptions để cấu hình các tùy chọn trích xuất và tệp PDF đầu vào.
  2. Gọi phương thức Extract của PdfExtractor để trích xuất siêu dữ liệu.
  3. Truy cập các thuộc tính đã trích xuất thông qua 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;

Cách trích xuất Siêu dữ liệu từ luồng PDF

Bạn có thể mở luồng tùy ý.

 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;

Cách trích xuất Siêu dữ liệu từ tệp PDF theo phong cách ngắn gọn nhất

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

Các tính năng chính:

  • Siêu dữ liệu có sẵn: Tiêu đề, Tác giả, Chủ đề, Từ khóa, Số trang.
 Tiếng Việt