PDF Optimizer

The Documentize PDF Optimizer 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.

Key Features:

  • Optimization: Reduce PDF file size without losing quality.
  • Rotation: Adjust the orientation of PDF pages.
  • Cropping: Remove unnecessary margins or content from the document.
  • Resizing: Resize pages to specific dimensions (e.g., A4, Letter).

Optimize PDF Document

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

  1. Create an instance of the Optimizer class.
  2. Create an OptimizeOptions object to configure optimization settings.
  3. Add input PDF file(s) and set an output location for the optimized file.
  4. Run the Process method to execute the optimization.
1var optimizer = new Optimizer();
2var optimizeOptions = new OptimizeOptions();
3optimizeOptions.AddInput(new FileDataSource("input.pdf"));
4optimizeOptions.AddOutput(new FileDataSource("output.pdf"));
5optimizer.Process(optimizeOptions);

Resize PDF Document

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

  1. Instantiate the Optimizer class.
  2. Create a ResizeOptions object to define the page size.
  3. Add the input file and set the desired output location.
  4. Use the SetPageSize method to specify the new size (e.g., A4).
  5. Call the Process method to apply the changes.
1var optimizer = new Optimizer();
2var resizeOptions = new ResizeOptions();
3resizeOptions.AddInput(new FileDataSource("input.pdf"));
4resizeOptions.SetPageSize(PageSize.A4);
5resizeOptions.AddOutput(new FileDataSource("output.pdf"));
6optimizer.Process(resizeOptions);

Rotate PDF Pages

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

  1. Instantiate the Optimizer class.
  2. Create a RotateOptions object and configure the rotation angle.
  3. Add the input PDF file and specify the output file location.
  4. Set the rotation angle (e.g., 90 degrees) using the SetRotation method.
  5. Execute the rotation with the Process method.
1var optimizer = new Optimizer();
2var rotateOptions = new RotateOptions();
3rotateOptions.AddInput(new FileDataSource("input.pdf"));
4rotateOptions.SetRotation(90);
5rotateOptions.AddOutput(new FileDataSource("output.pdf"));
6optimizer.Process(rotateOptions);

Crop PDF Document

Cropping removes unwanted content or margins from a PDF document. The CropOptions class can be used to define the crop area.

  1. Create an instance of the Optimizer class.
  2. Define the crop area with the CropOptions object.
  3. Add the input file and specify the output file location.
  4. Use the SetCropBox method to define the crop area.
  5. Execute the cropping with the Process method.
1var optimizer = new Optimizer();
2var cropOptions = new CropOptions();
3cropOptions.AddInput(new FileDataSource("input.pdf"));
4cropOptions.SetCropBox(new Rectangle(50, 50, 500, 700)); // Defines the crop area
5cropOptions.AddOutput(new FileDataSource("output.pdf"));
6optimizer.Process(cropOptions);
 English