public class Converter extends NativeObject
Constructor | Description |
---|---|
Converter() |
Modifier and Type | Method | Description |
---|---|---|
MultiPageDocument |
convertDocument(Document inDoc,
Stream outStream,
Profile profile) |
Convert all pages of a PDF document to a rasterized image
|
Document |
convertPage(Document inDoc,
Stream outStream,
Profile profile,
int pageNumber) |
Convert a single page of a PDF document to a rasterized image
|
equals, hashCode
public MultiPageDocument convertDocument(Document inDoc, Stream outStream, Profile profile) throws java.io.IOException, GenericException, LicenseException, UnsupportedFeatureException, ProcessingException
inDoc
- The input PDF documentoutStream
- The stream to which the rasterized image is written.profile
-
The profile defines how the PDF pages are rendered and what type of output image is used.
Note that the profile's image options must support multi-page images (TIFF).
For other profiles, the method convertPage(com.pdftools.pdf.Document, com.pdftools.sys.Stream, com.pdftools.pdf2image.profiles.Profile, int)
should be used.
For details, see profiles.Profile
.
The output image document. The object can be used as input for further processing.
Note that, this object must be disposed before the output stream
object (method argument outStream
).
LicenseException
- The license is invalid.java.io.IOException
- Writing to the output image failed.UnsupportedFeatureException
- The input PDF is a PDF collection (Portfolio) that has no cover pages.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields.
See pdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.GenericException
- An unexpected failure occurred.java.lang.IllegalArgumentException
- The profile
does not support multi-page output.ProcessingException
- The processing has failed.java.lang.IllegalStateException
- Internal error has occured.java.lang.IllegalArgumentException
- if inDoc
is null
java.lang.IllegalArgumentException
- if outStream
is null
java.lang.IllegalArgumentException
- if profile
is null
public Document convertPage(Document inDoc, Stream outStream, Profile profile, int pageNumber) throws java.io.IOException, GenericException, LicenseException, UnsupportedFeatureException, ProcessingException
inDoc
- The input PDF documentoutStream
- The stream to which the rasterized image is written.profile
- The profile defines how the PDF page is rendered and what type of output image is used.
For details, see profiles.Profile
.
pageNumber
- The PDF page number to be converted.
The number must be in the range of 1
(first page) to pdftools.pdf.Document.getPageCount
(last page).The image object allowing to open and read the output image and treat it as a new input for further processing.
Note that, this object must be disposed before the output stream
object (method argument outStream
).
LicenseException
- The license is invalid.java.lang.IllegalArgumentException
- The pageNumber
is not in the allowed range.java.io.IOException
- Writing to the output image failed.UnsupportedFeatureException
- The input PDF is a collection that has no cover pages.UnsupportedFeatureException
- The input PDF contains unrendered XFA form fields.
See pdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.GenericException
- An unexpected failure occurred.ProcessingException
- The processing has failed.java.lang.IllegalArgumentException
- if inDoc
is null
java.lang.IllegalArgumentException
- if outStream
is null
java.lang.IllegalArgumentException
- if profile
is null