Package com.pdftools.optimization
Class Optimizer
- java.lang.Object
-
- com.pdftools.internal.NativeBase
-
- com.pdftools.internal.NativeObject
-
- com.pdftools.optimization.Optimizer
-
public class Optimizer extends NativeObject
The class to optimize PDF documents
-
-
Constructor Summary
Constructors Constructor Description Optimizer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Document
optimizeDocument(Document inDoc, Stream outStream, Profile profile)
Optimize the PDF documentDocument
optimizeDocument(Document inDoc, Stream outStream, Profile profile, OutputOptions outOptions)
Optimize the PDF document-
Methods inherited from class com.pdftools.internal.NativeObject
equals, hashCode
-
-
-
-
Method Detail
-
optimizeDocument
public Document optimizeDocument(Document inDoc, Stream outStream, Profile profile) throws java.io.IOException, GenericException, LicenseException, ProcessingException
Optimize the PDF document
- Parameters:
inDoc
- The input PDF documentoutStream
- The stream to which the output PDF is writtenprofile
- The profile defining the optimization parameters.- 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
).- Throws:
LicenseException
- The license check has failed.java.lang.IllegalArgumentException
- An invalid encryption was specified inoutOptions
.ProcessingException
- The processing has failed.java.io.IOException
- Writing to the output PDF has failed.GenericException
- A generic error occurred.java.lang.IllegalArgumentException
- ifinDoc
isnull
java.lang.IllegalArgumentException
- ifoutStream
isnull
java.lang.IllegalArgumentException
- ifprofile
isnull
-
optimizeDocument
public Document optimizeDocument(Document inDoc, Stream outStream, Profile profile, OutputOptions outOptions) throws java.io.IOException, GenericException, LicenseException, ProcessingException
Optimize the PDF document
- Parameters:
inDoc
- The input PDF documentoutStream
- The stream to which the output PDF is writtenprofile
- The profile defining the optimization parameters.outOptions
- 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
).- Throws:
LicenseException
- The license check has failed.java.lang.IllegalArgumentException
- An invalid encryption was specified inoutOptions
.ProcessingException
- The processing has failed.java.io.IOException
- Writing to the output PDF has failed.GenericException
- A generic error occurred.java.lang.IllegalArgumentException
- ifinDoc
isnull
java.lang.IllegalArgumentException
- ifoutStream
isnull
java.lang.IllegalArgumentException
- ifprofile
isnull
-
-