v25.11
New plugin PDF Converter
- Class PdfConverter: contains all functions of plugins: DocConverter, XlsConverter, HtmlConverter, JpegConverter, PdfAConverter, PngConverter, TiffConverter.
- Class DocConverter: will be deleted soon, use PdfConverter.
- Class XlsConverter: will be deleted soon, use PdfConverter.
- Class HtmlConverter: will be deleted soon, use PdfConverter.
- Class JpegConverter: will be deleted soon, use PdfConverter.
- Class PdfAConverter: will be deleted soon, use PdfConverter.
- Class PngConverter: will be deleted soon, use PdfConverter.
- Class TiffConverter: will be deleted soon, use PdfConverter.
- Class PdfAConvertOptions: renamed to Class PdfToPdfAOptions.
- See The New Plugin Architecture.
Example Usage:
The example demonstrates how to convert PDF document to Doc format.
// 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);Example Usage:
The example demonstrates how to convert PDF to XLSX document.
// 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);Example Usage:
The example demonstrates how to convert PDF to HTML document.
// 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);Example Usage:
The example demonstrates how to convert HTML to PDF document.
// 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);Example Usage:
The example demonstrates how to convert PDF document into JPEG format.
// 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);Example Usage:
The example demonstrates how to convert PDF document into PNG format.
// 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);Example Usage:
The example demonstrates how to convert PDF document into TIFF format.
// 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);Example Usage:
The example demonstrates how to convert the PDF document in a PDF/A format (PDF/A-3b in this case):
// 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);Example Usage:
The example demonstrates how to validate the PDF document conformance to PDF/A format (PDF/A-1a in this case):
// 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
}New plugin PDF Security
- Class PdfSecurity: contains all functions of plugins: Security, Signature, Timestamp.
- Class Security: will be deleted soon, use PdfSecurity.
- Class Signature: will be deleted soon, use PdfSecurity.
- Class Timestamp: will be deleted soon, use PdfSecurity.
- Class DecryptionOptions: renamed to Class DecryptOptions.
- Class EncryptionOptions: renamed to Class EncryptOptions.
- Class SignOptions: now have properties for Class Timestamp.
- See The New Plugin Architecture.
Example Usage:
The example demonstrates how to Encrypt PDF document.
// 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);Example Usage:
The example demonstrates how to Decrypt PDF document.
// 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);Example Usage:
The example demonstrates how to Sign PDF document.
// 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);Example Usage:
The example demonstrates how Sign PDF document with 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 integrated to PdfManager
- Class PdfChatGpt: will be deleted soon, use PdfManager.
- Class PdfChatGptRequestOptions: renamed to **Class ChatGptRequestOptions **.
New options available for work with ChatGpt
- Class ChatCompletion: allow checking results of request.
- Class Choice: allow checking results of request.
- Class Usage: allow checking results of request.
- Class ChatGptConsts: allow using extra settings like ModelName, API URL and other.
Example Usage:
The example demonstrates how to use ChatGpt by adding messages to the request.
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.Enhancements
- PDF to Image - Improve conversion performance
- PDF to TIFF - Improve Conversion speed
- PDF to Doc - Improve performance
Fixed Bugs
- Fixed HTML to PDF - Formatting issues in resultant file
- Fixed Performance issue in PDF to TIFF conversion
- Fixed HTML to PDF - CSS file as External Resource not applying to the generated PDF file