Skip to content

Instantly share code, notes, and snippets.

@documentize
documentize / pdf-merger.cs
Last active March 4, 2026 11:07
The example demonstrates how to Merge two PDF documents.
// Create MergeOptions object to set instructions
var options = new MergeOptions();
// Add input file paths
options.AddInput(new FileData("path_to_your_pdf_file_1.pdf"));
options.AddInput(new FileData("path_to_your_pdf_file_2.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Merge(options);
@documentize
documentize / pdf-optimizer.cs
Last active October 6, 2025 08:13
The example demonstrates how to Optimize/Rotate/Resize/Compress PDF document using Documentize for .NET SDK.
// The example demonstrates how to Optimize PDF document.
{
// Create OptimizeOptions object to set instructions
var options = new OptimizeOptions();
// 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
PdfManager.Optimize(options);
@documentize
documentize / convert-to-pdfa.cs
Last active March 10, 2026 13:13
The example demonstrates how to convert the PDF document in a PDF/A format (PDF/A-3b in this case) using Documentize for .NET SDK.
// 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 FileData("path_to_your_pdf_file.pdf")); // replace with your actual file path
// Add the path to save the converted file
@documentize
documentize / add-messages-chatgpt-request.cs
Last active November 14, 2025 08:53
The examples demonstrates how to use PdfChatGpt plugin of Documentize for .NET SDK.
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.",
@documentize
documentize / extract-text-from-pdf.cs
Last active February 16, 2026 07:38
The example demonstrates how to extract text content of PDF document.
// Create ExtractTextOptions object to set input file path
var options = new ExtractTextOptions("path_to_your_pdf_file.pdf");
// Perform the process and get the extracted text
var textExtracted = PdfExtractor.Extract(options);
@documentize
documentize / encypt-pdf.cs
Last active March 10, 2026 14:03
The example demonstrates how to encrypt PDF document using Documentize for .NET SDK.
// Create EncryptOptions object to set instructions
var options = new EncryptOptions("123456", "qwerty");
// 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_pdf_file.pdf"));
// Perform the process
PdfSecurity.Encrypt(options);
@documentize
documentize / decrypt-pdf.cs
Last active March 10, 2026 14:03
The example demonstrates how to decrypt PDF document using Documentize for .NET SDK.
// Create DecryptOptions object to set instructions
var options = new DecryptOptions("123456");
// 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_pdf_file.pdf"));
// Perform the process
PdfSecurity.Decrypt(options);
@documentize
documentize / sign-pdf.cs
Last active August 14, 2026 07:02
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);
@documentize
documentize / split-pdf.cs
Last active March 10, 2026 13:34
The example demonstrates how to split PDF document into several PDF files using Documentize for .NET SDK.
// Create SplitOptions object to set instructions
var options = new SplitOptions();
// Add input file path
options.AddInput(new FileData("path_to_your_pdf_file.pdf"));
// Set output file paths
options.AddOutput(new FileData("path_to_result_pdf_file_1.pdf"));
options.AddOutput(new FileData("path_to_result_pdf_file_2.pdf"));
// Perform the process
PdfManager.Split(options);
@documentize
documentize / pdf-to-excel.cs
Last active March 10, 2026 13:14
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 FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_xlsx_file.xlsx"));
// Perform the process
PdfConverter.Convert(options);