Click or drag to resize
Pdftools logo

OptimizerOptimizeDocument Method

Optimize the PDF document


Namespace: PdfTools.Optimization
Assembly: PdfTools (in PdfTools.dll) Version: 1.0.0
Syntax
C#
public Document OptimizeDocument(
	Document inDoc,
	Stream outStream,
	Profile profile,
	OutputOptions outOptions = null
)

Parameters

inDoc  Document
The input PDF document
outStream  Stream
The stream to which the output PDF is written
profile  Profile
The profile defining the optimization parameters.
outOptions  OutputOptions  (Optional)
The PDF output options, e.g. to encrypt the output document.

Return Value

Document

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).

Exceptions
ExceptionCondition
LicenseExceptionThe license check has failed.
ArgumentExceptionAn invalid encryption was specified in outOptions.
ProcessingExceptionThe processing has failed.
IOExceptionWriting to the output PDF has failed.
GenericExceptionA generic error occurred.
ArgumentNullExceptionif inDoc is .
ArgumentNullExceptionif outStream is .
ArgumentNullExceptionif profile is .
See Also