v26.8
SignOptions class has been redesigned
- Now it’s easier to use.
- Inheritance from OptionsWithInputAndOutput class.
- Properties Inputs and Outputs changed to Input and Output. Now there is only 1 input and output.
- If the output is a file, its stream will be closed automatically, but if it is a Stream, it will remain open for further use.
- Removed methods AddInput, AddOutput.
- Added several more convenient constructors:
- 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)
- Added modifiable properties:
- Stream Pfx
- string PfxPassword
- IData Input
- IData Output
Example Usage:
The example of working with 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");Example Usage:
The example demonstrates how to Sign a PDF file in the shortest possible style.
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"));Example Usage:
The example demonstrates how to Sign a PDF document using streams.
// 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);Removed class Signature
- The previous implementation of plugins is gradually being retired. The functionality of this class has been replaced by class PdfSecurity.
- Class Signature: removed, use PdfSecurity.
Example Usage:
The example demonstrates how to Sign a PDF document.
// 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);Removed class FormExporter
- The previous implementation of plugins is gradually being retired. The functionality of this class has been replaced by classes PdfExtractor and PdfForm.
- Class FormExporter: removed, use PdfExtractor or PdfForm.
Example Usage:
The example demonstrates how to Export Form values to CSV file with 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);Example Usage:
The example demonstrates how to Export Form values to TSV file and set Properties with 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);Improved class FileData
- Overridden method ToString().
Other fixes
📄 PDF to DOC
- Fixed PDF to DOC conversion taking excessive time
🌐 PDF to HTML/HTML to PDF
- Fixed PDF to HTML conversion producing transparent images
- Fixed HTML to PDF conversion where content overlapped
- Fixed HTML to PDF conversion where table width was ignored
🖼️ PDF to PNG/TIFF
- Fixed PDF to PNG conversion consuming excessive memory
- Fixed PDF to PNG conversion not preserving embedded fonts
- Fixed PDF to TIFF conversion throwing an exception
📑 PDF to PDF/A
- Fixed PDF to PDF/A conversion losing document colors
- Fixed PDF to PDF/A conversion overlapping text in output
- Fixed PDF to PDF/A Validate() method returning incorrect results
- Fixed PDF/A validation producing incorrect results
📂 Other Operations
- Fixed System.FormatException thrown when verifying a PDF signature
- Fixed merging documents throwing an exception