Class Converter
- java.lang.Object
-
- com.pdftools.internal.NativeBase
-
- com.pdftools.internal.NativeObject
-
- com.pdftools.pdf2image.Converter
-
public class Converter extends NativeObject
The class to convert a PDF document to a rasterized image
-
-
Constructor Summary
Constructors Constructor Description Converter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiPageDocument
convertDocument(Document inDoc, Stream outStream, Profile profile)
Convert all pages of a PDF document to a rasterized imageDocument
convertPage(Document inDoc, Stream outStream, Profile profile, int pageNumber)
Convert a single page of a PDF document to a rasterized image-
Methods inherited from class com.pdftools.internal.NativeObject
equals, hashCode
-
-
-
-
Method Detail
-
convertDocument
public MultiPageDocument convertDocument(Document inDoc, Stream outStream, Profile profile) throws java.io.IOException, GenericException, LicenseException, UnsupportedFeatureException, ProcessingException
Convert all pages of a PDF document to a rasterized image
- Parameters:
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
.- Returns:
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
).- Throws:
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. Seepdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.GenericException
- An unexpected failure occurred.java.lang.IllegalArgumentException
- Theprofile
does not support multi-page output.ProcessingException
- The processing has failed.java.lang.IllegalStateException
- Internal error has occured.java.lang.IllegalArgumentException
- ifinDoc
isnull
java.lang.IllegalArgumentException
- ifoutStream
isnull
java.lang.IllegalArgumentException
- ifprofile
isnull
-
convertPage
public Document convertPage(Document inDoc, Stream outStream, Profile profile, int pageNumber) throws java.io.IOException, GenericException, LicenseException, UnsupportedFeatureException, ProcessingException
Convert a single page of a PDF document to a rasterized image
- Parameters:
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 of1
(first page) topdftools.pdf.Document.getPageCount
(last page).- Returns:
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
).- Throws:
LicenseException
- The license is invalid.java.lang.IllegalArgumentException
- ThepageNumber
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. Seepdftools.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
- ifinDoc
isnull
java.lang.IllegalArgumentException
- ifoutStream
isnull
java.lang.IllegalArgumentException
- ifprofile
isnull
-
-