pdftools_sdk.optimization.optimizer
Classes
The class to optimize PDF documents |
- class pdftools_sdk.optimization.optimizer.Optimizer[source]
Bases:
_NativeObject
The class to optimize PDF documents
- optimize_document(in_doc: Document, out_stream: IOBase, profile: Profile, out_options: OutputOptions | None = None) Document [source]
Optimize the PDF document
- Parameters:
inDoc (pdftools_sdk.pdf.document.Document) – The input PDF document
outStream (io.IOBase) – The stream to which the output PDF is written
profile (pdftools_sdk.optimization.profiles.profile.Profile) – The profile defining the optimization parameters.
outOptions (Optional[pdftools_sdk.pdf.output_options.OutputOptions]) – The PDF output options, e.g. to encrypt the output document.
- Returns:
The optimized result PDF, which can be used as a new input for further processing.
Note that, this object must be disposed before the output stream object (method argument outStream).
- Return type:
- Raises:
pdftools_sdk.license_error.LicenseError – The license check has failed.
ValueError – An invalid encryption was specified in outOptions.
pdftools_sdk.processing_error.ProcessingError – The processing has failed.
OSError – Writing to the output PDF has failed.
pdftools_sdk.generic_error.GenericError – A generic error occurred.