v25.11

Plugin mới PDF Converter

  • Class PdfConverter: chứa toàn bộ các chức năng của các plugin: DocConverter, XlsConverter, HtmlConverter, JpegConverter, PdfAConverter, PngConverter, TiffConverter.
  • Class DocConverter: sẽ sớm bị xóa, hãy sử dụng PdfConverter.
  • Class XlsConverter: sẽ sớm bị xóa, hãy sử dụng PdfConverter.
  • Class HtmlConverter: sẽ sớm bị xóa, hãy sử dụng PdfConverter.
  • Class JpegConverter: sẽ sớm bị xóa, hãy sử dụng PdfConverter.
  • Class PdfAConverter: sẽ sớm bị xóa, hãy sử dụng PdfConverter.
  • Class PngConverter: sẽ sớm bị xóa, hãy sử dụng PdfConverter.
  • Class TiffConverter: sẽ sớm bị xóa, hãy sử dụng PdfConverter.
  • Class PdfAConvertOptions: được đổi tên thành Class PdfToPdfAOptions.
  • Xem The New Plugin Architecture.

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi tài liệu PDF sang định dạng Doc.

// Create PdfToDocOptions object to set instructions
var options = new PdfToDocOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_file.doc"));
// Perform the process
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi PDF sang tài liệu XLSX.

// Create PdfToXlsOptions object to set instructions
var options = new PdfToXlsOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_xlsx_file.xlsx"));
// Perform the process
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi PDF sang tài liệu HTML.

// Create PdfToHtmlOptions object to set output data type as file with embedded resources
var options = new PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);
// Add input file path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.html"));
// Perform the process
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi HTML sang tài liệu PDF.

// Create HtmlToPdfOptions
var options = new HtmlToPdfOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_input.html"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.pdf"));
// Perform the process
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi tài liệu PDF sang định dạng JPEG.

// Create PdfToJpegOptions object to set instructions
var options = new PdfToJpegOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi tài liệu PDF sang định dạng PNG.

// Create PdfToPngOptions object to set instructions
var options = new PdfToPngOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi tài liệu PDF sang định dạng TIFF.

// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách chuyển đổi tài liệu PDF sang định dạng PDF/A (trong ví dụ này là PDF/A-3b):

// Create the options class to set up the conversion process
var options = new PdfToPdfAOptions
{
    PdfAVersion = PdfAStandardVersion.PDF_A_3B
};

// Add the source file
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf")); // replace with your actual file path

// Add the path to save the converted file
options.AddOutput(new FileDataSource("path_to_the_converted_file.pdf"));

// Run the conversion
PdfConverter.Convert(options);

Ví dụ sử dụng:

Ví dụ minh họa cách xác minh tài liệu PDF tuân thủ định dạng PDF/A (trong ví dụ này là PDF/A-1a):

// Create the options class to set up the validation process
var options = new PdfAValidateOptions
{
    PdfAVersion = PdfAStandardVersion.PDF_A_1A
};

// Add one or more files to be validated
options.AddInput(new FileDataSource("path_to_your_first_pdf_file.pdf")); // replace with your actual file path
options.AddInput(new FileDataSource("path_to_your_second_pdf_file.pdf"));
// add more files as needed

// Run the validation and get results
var resultContainer = PdfConverter.Validate(options);

// Check the resultContainer.ResultCollection property for validation results for each file:
for (var i = 0; i < resultContainer.ResultCollection.Count; i++)
{
    var result = resultContainer.ResultCollection[i];
    var validationResult = (PdfAValidationResult)result.Data;
    var isValid = validationResult.IsValid; // Validation result for the i-th document
}

Plugin mới PDF Security

  • Class PdfSecurity: chứa toàn bộ các chức năng của các plugin: Security, Signature, Timestamp.
  • Class Security: sẽ sớm bị xóa, hãy sử dụng PdfSecurity.
  • Class Signature: sẽ sớm bị xóa, hãy sử dụng PdfSecurity.
  • Class Timestamp: sẽ sớm bị xóa, hãy sử dụng PdfSecurity.
  • Class DecryptionOptions: được đổi tên thành Class DecryptOptions.
  • Class EncryptionOptions: được đổi tên thành Class EncryptOptions.
  • Class SignOptions: hiện có các thuộc tính cho Class Timestamp.
  • Xem The New Plugin Architecture.

Ví dụ sử dụng:

Ví dụ minh họa cách Mã hoá tài liệu PDF.

// Create EncryptOptions object to set instructions
var options = new EncryptOptions("123456", "qwerty");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Encrypt(options);

Ví dụ sử dụng:

Ví dụ minh họa cách Giải mã tài liệu PDF.

// Create DecryptOptions object to set instructions
var options = new DecryptOptions("123456");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Decrypt(options);

Ví dụ sử dụng:

Ví dụ minh họa cách Ký tài liệu PDF.

// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Sign(options);

Ví dụ sử dụng:

Ví dụ minh họa cách Ký tài liệu PDF kèm Timestamp.

// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_for_your_pfx_file");
options.TimestampOptions = new TimestampOptions("server_url");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Sign(options);

Plugin PdfChatGpt tích hợp vào PdfManager

  • Class PdfChatGpt: sẽ sớm bị xóa, hãy sử dụng PdfManager.
  • Class PdfChatGptRequestOptions: được đổi tên thành Class ChatGptRequestOptions.

Các tùy chọn mới cho việc làm việc với ChatGpt

  • Class ChatCompletion: cho phép kiểm tra kết quả của yêu cầu.
  • Class Choice: cho phép kiểm tra kết quả của yêu cầu.
  • Class Usage: cho phép kiểm tra kết quả của yêu cầu.
  • Class ChatGptConsts: cho phép sử dụng các cài đặt bổ sung như ModelName, API URL và các thứ khác.

Ví dụ sử dụng:

Ví dụ minh họa cách sử dụng ChatGpt bằng cách thêm tin nhắn vào yêu cầu.

var options = new ChatGptRequestOptions();
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.

// Add the request messages.
options.Messages.Add(new Message
{
    Content = "You are a helpful assistant.",
    Role = Role.System
});
options.Messages.Add(new Message
{
    Content = "What is the biggest pizza diameter ever made?",
    Role = Role.User
});

// Process the request.
var result = await PdfManager.CreatePdfByChatGptRequestAsync(options);

var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.

Cải tiến

  • PDF to Image – Cải thiện hiệu năng chuyển đổi
  • PDF to TIFF – Tăng tốc độ chuyển đổi
  • PDF to Doc – Cải thiện hiệu năng

Lỗi đã sửa

  • Sửa lỗi HTML to PDF – Các vấn đề định dạng trong file kết quả
  • Sửa lỗi hiệu năng trong chuyển đổi PDF to TIFF
  • Sửa lỗi HTML to PDF – Tệp CSS được khai báo là External Resource không áp dụng cho file PDF được tạo.
7 thg 9, 2026
 Tiếng Việt