Optimize PDF

The Documentize PDF Manager for .NET is a comprehensive plugin that enhances PDF documents through advanced optimization techniques. It is designed to help reduce file sizes, rotate pages, crop content, and resize documents. These operations improve the quality and manageability of PDF files, making them easier to store, share, and view.

Optimize PDF

The following steps demonstrate how to optimize a PDF document by reducing its file size while maintaining quality.

  1. Create an OptimizeOptions object to configure optimization settings.
  2. Add input PDF file(s) and set an output location for the optimized file.
  3. Run the Optimize method of PdfManager to execute the optimization.
1// Create OptimizeOptions object to set instructions
2var options = new OptimizeOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfManager.Optimize(options);

Rotate PDF

Use the RotateOptions class to adjust the orientation of pages in a PDF file.

  1. Create a RotateOptions object and configure the rotation angle.
  2. Add the input PDF file and specify the output file location.
  3. Set the rotation angle (e.g., 90 degrees) using the SetRotation method.
  4. Run the Rotate method of PdfManager.
 1// Create RotateOptions object to set instructions
 2var options = new RotateOptions();
 3// Set new Rotation
 4options.Rotation = Rotation.On90;
 5// Add input file path
 6options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 7// Set output file path
 8options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
 9// Perform the process
10PdfManager.Rotate(options);

Resize PDF

To resize a PDF document, the ResizeOptions class is used to specify the new page size for the document.

  1. Create a ResizeOptions object to define the page size.
  2. Add the input file and set the desired output location.
  3. Use the SetPageSize method to specify the new size (e.g., A4).
  4. Run the Resize method of PdfManager.
 1// Create ResizeOptions object to set instructions
 2var options = new ResizeOptions();
 3// Set new PageSize
 4options.PageSize = PageSize.A3;
 5// Add input file path
 6options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
 7// Set output file path
 8options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
 9// Perform the process
10PdfManager.Resize(options);

Compress PDF

Compress PDF document when feasible by eliminating unused page resources, merging identical assets, and discarding redundant objects.

  1. Create an CompressOptions object to configure optimization settings.
  2. Add the input file and specify the output file location.
  3. Use the SetCropBox method to define the crop area.
  4. Run the Compress method of PdfManager.
1// Create CompressOptions object to set instructions
2var options = new CompressOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Set output file path
6options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
7// Perform the process
8PdfManager.Compress(options);

Key Features:

  • Optimization: Reduce PDF file size without losing quality.
  • Rotation: Adjust the orientation of PDF pages.
  • Resizing: Resize pages to specific dimensions (e.g., A4, Letter).
  • Compressing: Remove unused page resources and objects from the document.