v26.8

Lớp SignOptions đã được thiết kế lại

  • Giờ đây việc sử dụng dễ dàng hơn.
  • Kế thừa từ lớp OptionsWithInputAndOutput.
  • Thuộc tính InputsOutputs được đổi thành InputOutput. Hiện chỉ có 1 input và 1 output.
  • Nếu output là một tệp, luồng của nó sẽ tự động được đóng; nếu là một Stream, nó sẽ vẫn mở để sử dụng tiếp.
  • Loại bỏ các phương pháp AddInput, AddOutput.
  • Thêm một số hàm khởi tạo thuận tiện hơn:
    • SignOptions(IData inputData, IData outputData, IData pfxData, string password)
    • SignOptions(string inputFile, string outputFile, string pfxFile, string pfxPassword)
    • SignOptions(Stream inputStream, Stream outputStream, Stream pfxStream, string pfxPassword)
  • Thêm các thuộc tính có thể sửa đổi:
    • Stream Pfx
    • string PfxPassword
    • IData Input
    • IData Output

Ví dụ sử dụng:

Ví dụ về cách làm việc với SignOptions.

using var pfxStream = File.OpenRead(@"path_to_your_pfx_file.pfx");
var options = new SignOptions(pfxStream, "password_of_your_pfx_file");
// Set input and output file paths
options.Input = new FileData("path_to_your_pdf_file.pdf");
options.Output = new FileData("path_to_result_pdf_file.pdf");

Ví dụ sử dụng:

Ví dụ minh họa cách ký một tệp PDF theo cách ngắn gọn nhất.

PdfSecurity.Sign(new SignOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf", "path_to_your_pfx_file.pfx", "password_of_your_pfx_file"));

Ví dụ sử dụng:

Ví dụ minh họa cách ký một tài liệu PDF bằng các stream.

// Prepare streams
using var pdfStreamInput = File.OpenRead(@"path_to_your_pdf_file.pdf");
using var pfxStreamInput = File.OpenRead(@"path_to_your_pfx_file.pfx");
using var pdfStreamOutput = new MemoryStream();
// Create SignOptions object to set instructions
var options = new SignOptions(pdfStreamInput, pdfStreamOutput, pfxStreamInput, "password_of_your_pfx_file");
// Perform the process
PdfSecurity.Sign(options);

Đã loại bỏ lớp Signature

  • Việc triển khai plugin trước đây đang dần được ngừng. Chức năng của lớp này đã được thay thế bằng lớp PdfSecurity.
  • Class Signature: đã loại bỏ, sử dụng PdfSecurity.

Ví dụ sử dụng:

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

// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pdf_file.pdf", "path_to_result_pdf_file.pdf", "path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
// Perform the process
PdfSecurity.Sign(options);

Đã loại bỏ lớp FormExporter

  • Việc triển khai plugin trước đây đang dần được ngừng. Chức năng của lớp này đã được thay thế bằng các lớp PdfExtractorPdfForm.
  • Class FormExporter: đã loại bỏ, sử dụng PdfExtractor hoặc PdfForm.

Ví dụ sử dụng:

Ví dụ minh họa cách xuất giá trị Form ra tệp CSV bằng PdfExtractor..

// Create ExtractFormDataToDsvOptions object to set instructions
var options = new ExtractFormDataToDsvOptions(',', true);
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_csv_file.csv"));
// Perform the process
PdfExtractor.Extract(options);

Ví dụ sử dụng:

Ví dụ minh họa cách xuất giá trị Form ra tệp TSV và thiết lập các thuộc tính bằng PdfForm.

// Create ExtractFormDataToDsvOptions object to set instructions
var options = new ExtractFormDataToDsvOptions();
//Set Delimiter
options.Delimiter = '\t';
//Add Field Names to result
options.AddFieldName = true;
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_csv_file.tsv"));
// Perform the process
PdfForm.Extract(options);

Cải tiến lớp FileData

  • Ghi đè phương thức ToString().

Các sửa lỗi khác

📄 PDF sang DOC

  • Sửa lỗi chuyển đổi PDF sang DOC tốn thời gian quá mức

🌐 PDF sang HTML / HTML sang PDF

  • Sửa lỗi chuyển đổi PDF sang HTML tạo ra hình ảnh trong suốt
  • Sửa lỗi chuyển đổi HTML sang PDF khi nội dung chồng lên nhau
  • Sửa lỗi chuyển đổi HTML sang PDF khi chiều rộng bảng bị bỏ qua

🖼️ PDF sang PNG/TIFF

  • Sửa lỗi chuyển đổi PDF sang PNG tiêu tốn bộ nhớ quá mức
  • Sửa lỗi chuyển đổi PDF sang PNG không giữ nguyên phông chữ nhúng
  • Sửa lỗi chuyển đổi PDF sang TIFF ném ngoại lệ

📑 PDF sang PDF/A

  • Sửa lỗi chuyển đổi PDF sang PDF/A mất màu sắc tài liệu
  • Sửa lỗi chuyển đổi PDF sang PDF/A gây chồng chữ trong kết quả
  • Sửa lỗi phương thức Validate() của PDF/A trả về kết quả không chính xác
  • Sửa lỗi xác thực PDF/A tạo ra kết quả không chính xác

📂 Các thao tác khác

  • Sửa lỗi System.FormatException bị ném khi xác thực chữ ký PDF
  • Sửa lỗi khi gộp tài liệu ném ngoại lệ
13 thg 8, 2026
 Tiếng Việt