PDF Extractor

Extract Text

Trích xuất văn bản từ tài liệu PDF một cách chính xác với các công cụ .NET của Documentize — lấy, xử lý và phân tích nội dung một cách dễ dàng.

Trích xuất hình ảnh

Trích xuất hình ảnh một cách dễ dàng từ tài liệu PDF trong các ứng dụng .NET

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

Trích xuất siêu dữ liệu từ các tệp PDF một cách chính xác với Documentize bằng C#/.NET

Xuất Dữ Liệu Biểu Mẫu

Trích xuất và xuất dữ liệu từ các biểu mẫu PDF (AcroForms) sang các định dạng khác như CSV bằng C#/.NET

Tiểu mục của PDF Extractor

Extract Text

The Documentize PDF Extractor for .NET simplifies extracting text from PDF documents. Whether you need pure, raw, or plain text, this plugin allows you to extract text efficiently while preserving formatting or omitting it based on your needs.

How to Extract Text from PDF file

To extract text from a PDF file, follow these steps:

  1. Create an instance of ExtractTextOptions to configure input file path.
  2. Run the Extract method to extract the text.
1```csharp
2// Create ExtractTextOptions object to set input file path
3var options = new ExtractTextOptions("path_to_your_pdf_file.pdf");
4// Perform the process and get the extracted text
5var textExtracted = PdfExtractor.Extract(options);
6```

How to Extract Text from PDF stream

To extract text from a PDF stream, follow these steps:

  1. Create an instance of ExtractTextOptions to configure input stream.
  2. Run the Extract method to extract the text.
1```csharp
2// Create ExtractTextOptions object to set input stream
3var stream = File.OpenRead("path_to_your_pdf_file.pdf");
4var options = new ExtractTextOptions(stream);
5// Perform the process and get the extracted text
6var textExtracted = PdfExtractor.Extract(options);
7```

Text Extraction Modes

The ExtractTextOptions offers three extraction modes, providing flexibility based on your needs.

  1. Pure Mode: Preserves the original formatting, including spaces and alignment.
  2. Raw Mode: Extracts the text without formatting, useful for raw data processing.
  3. Flatten Mode: Represent PDF content with positioning text fragments by their coordinates.
1```csharp
2// Create ExtractTextOptions object to set input file path and TextFormattingMode
3var options = new ExtractTextOptions("path_to_your_pdf_file.pdf", TextFormattingMode.Pure);
4// Perform the process and get the extracted text
5var textExtracted = PdfExtractor.Extract(options);
6```

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

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

Key Features:

  • Pure Mode: Extract text while preserving its original formatting.
  • Raw Mode: Extract text without any formatting.
  • Flatten Mode: Extract text without special characters or formatting.

Trích xuất hình ảnh

Plugin Documentize PDF Extractor for .NET cho phép bạn dễ dàng trích xuất hình ảnh từ các tài liệu PDF. Nó quét các tệp PDF, xác định các hình ảnh được nhúng và trích xuất chúng đồng thời giữ nguyên chất lượng và định dạng gốc. Công cụ này nâng cao khả năng tiếp cận nội dung hình ảnh và tối ưu hoá quá trình lấy hình ảnh từ PDF.

Cách trích xuất hình ảnh từ PDF

Để trích xuất hình ảnh từ một tệp PDF, thực hiện các bước sau:

  1. Tạo một thể hiện của lớp ExtractImagesOptions.
  2. Thêm đường dẫn tệp đầu vào vào tùy chọn bằng phương thức AddInput.
  3. Đặt đường dẫn thư mục đầu ra cho các hình ảnh bằng phương thức AddOutput.
  4. Thực hiện quá trình trích xuất hình ảnh bằng plugin.
  5. Lấy các hình ảnh đã được trích xuất từ bộ chứa kết quả.
 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();

Trích xuất hình ảnh từ tệp PDF vào Streams mà không cần thư mục

Plugin PdfExtractor hỗ trợ lưu vào streams, cho phép bạn trích xuất hình ảnh từ các tệp PDF vào streams mà không cần tạo thư mục tạm.

 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}

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

  • Trích xuất hình ảnh được nhúng: Nhận diện và trích xuất hình ảnh từ tài liệu PDF.
  • Bảo toàn chất lượng hình ảnh: Đảm bảo các hình ảnh đã trích xuất giữ nguyên chất lượng gốc.
  • Đầu ra linh hoạt: Lưu hình ảnh đã trích xuất ở định dạng hoặc vị trí mà bạn ưu tiên.

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

The Documentize PDF Extractor for .NET simplifies extracting Metadata from PDF documents. Available properties that may interest you: FileName, Title, Author, Subject, Keywords, Created, Modified, Application, PDF Producer, Number of Pages.

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

The example demonstrates how to Extract Properties (Title, Author, Subject, Keywords, Number of Pages) from PDF file. To extract metadata from a PDF document, follow these steps:

  1. Create an instance of ExtractPropertiesOptions to configure the extraction options and input PDF file.
  2. Run the Extract method of PdfExtractor to extract the metadata.
  3. Access the extracted properties using the 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;

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

You can open the stream at your own discretion.

 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;

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"));

Tính năng chính:

  • Siêu dữ liệu khả dụng: FileName, Title, Author, Subject, Keywords, Created, Modified, Application, PDF Producer, Number of Pages.

Xuất Dữ Liệu Biểu Mẫu

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.

Cách Xuất Dữ Liệu Biểu Mẫu từ PDF sang CSV

Để xuất dữ liệu biểu mẫu từ PDF sang CSV, làm theo các bước sau:

  1. Tạo một thể hiện của lớp ExtractImagesOptions.
  2. Định nghĩa các tùy chọn xuất bằng lớp FormExporterValuesToCsvOptions.
  3. Thêm các tệp PDF đầu vào và chỉ định tệp CSV đầu ra.
  4. Chạy phương thức Extract để thực hiện việc xuất.
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);

Cách Xuất Dữ Liệu Biểu Mẫu từ PDF sang TSV

Sử dụng Tab làm ký tự phân tách.

 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);

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

  • 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.
 Tiếng Việt