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.
Optimize PDF
The following steps demonstrate how to optimize a PDF document by reducing its file size while maintaining quality.
- 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 ofOptimizer
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
8Optimizer.Process(options);
Rotate PDF
Use the RotateOptions class to adjust the orientation of pages in a PDF file.
- 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.
- Run the
Process
method ofOptimizer
.
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
10Optimizer.Process(options);
Resize PDF
To resize a PDF document, the ResizeOptions class is used to specify the new page size for the document.
- 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).
- Run the
Process
method ofOptimizer
.
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
10Optimizer.Process(options);
Compress PDF
Compress PDF document when feasible by eliminating unused page resources, merging identical assets, and discarding redundant objects.
- Create an CompressOptions object to configure optimization settings.
- Add the input file and specify the output file location.
- Use the SetCropBox method to define the crop area.
- Run the
Process
method ofOptimizer
.
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
8Optimizer.Process(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.