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.
- Create an instance of the Optimizer class.
- Create an OptimizeOptions object to configure optimization settings.
- Add input PDF file(s) and set an output location for the optimized file.
- 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.
- Instantiate the Optimizer class.
- Create a ResizeOptions object to define the page size.
- Add the input file and set the desired output location.
- Use the SetPageSize method to specify the new size (e.g., A4).
- 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.
- Instantiate the Optimizer class.
- Create a RotateOptions object and configure the rotation angle.
- Add the input PDF file and specify the output file location.
- Set the rotation angle (e.g., 90 degrees) using the SetRotation method.
- 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.
- Create an instance of the Optimizer class.
- Define the crop area with the CropOptions object.
- Add the input file and specify the output file location.
- Use the SetCropBox method to define the crop area.
- 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);