PdfConverter
Overview
PdfConverter is a class in Aspose.Pdf FOSS for Java.
Inherits from: AutoCloseable.
Converts PDF pages to raster images (JPEG, PNG).
Properties
| Name | Type | Access | Description |
|---|---|---|---|
document | Document | Read | Returns the currently bound document. |
pageCount | int | Read | Returns the total number of pages in the bound document. |
startPage | int | Read | Returns the start page, or 0 if unset. |
endPage | int | Read | Returns the end page, or 0 if unset. |
resolution | Resolution | Read | Returns the current resolution. |
coordinateType | PageCoordinateType | Read | Returns which page box should be used as the coordinate space. |
Methods
| Signature | Description |
|---|---|
PdfConverter() | Creates a new {@code PdfConverter} instance with default resolution of 150 DPI. |
PdfConverter(document: Document) | Creates a new converter bound to the supplied document. |
bindPdf(inputFile: String) → boolean | Binds a PDF file to this converter. |
bindPdf(inputStream: InputStream) → boolean | Binds a PDF from an input stream. |
bindPdf(document: Document) → boolean | Binds an existing {@link Document} to this converter. |
getDocument() → Document | Returns the currently bound document. |
setResolution(resolution: Resolution) | Sets the resolution for image rendering. |
doConvert() → boolean | Initializes the conversion process by resetting the page counter. |
getPageCount() → int | Returns the total number of pages in the bound document. |
setStartPage(startPage: int) | Sets the first page (1-based) to include in subsequent renders. |
setEndPage(endPage: int) | Sets the last page (1-based, inclusive) for subsequent renders. |
getStartPage() → int | Returns the start page, or 0 if unset. |
getEndPage() → int | Returns the end page, or 0 if unset. |
getResolution() → Resolution | Returns the current resolution. |
getCoordinateType() → PageCoordinateType | Returns which page box should be used as the coordinate space. |
setCoordinateType(coordinateType: PageCoordinateType) | Sets which page box should be used as the coordinate space. |
hasNextImage() → boolean | Returns whether there are more pages to convert. |
getNextImage(outputFile: String, format: String) → boolean | Renders the next page to an image file. |
getNextImage(stream: OutputStream, format: String) → boolean | Renders the next page to an output stream. |
getNextImage(outputFile: String, format: ImageFormat) → boolean | Renders the next page to an image file using the given {@link ImageFormat}. |
getNextImage(outputFile: String, format: ImageFormat, quality: int) → boolean | Renders the next page to an image file with explicit JPEG quality. |
getNextImage(stream: OutputStream, format: ImageFormat) → boolean | Renders the next page to an output stream using the given {@link ImageFormat}. |
getNextImage(stream: OutputStream, format: ImageFormat, quality: int) → boolean | Renders the next page to an output stream with explicit JPEG quality. |
getNextImage(outputFile: String) → boolean | Renders the next page to a file using default JPEG format. |
getNextImage(stream: OutputStream) → boolean | Renders the next page to a stream using default JPEG format. |
getNextImage(outputFile: String, format: ImageFormat, width: int, height: int) → boolean | Renders the next page to a file with explicit output dimensions. |
getNextImage(outputFile: String, format: ImageFormat, width: int, height: int, quality: int) → boolean | Renders the next page to a file with explicit dimensions and JPEG quality. |
getNextImage(stream: OutputStream, format: ImageFormat, width: int, height: int) → boolean | Renders the next page to a stream with explicit output dimensions. |
getNextImage(stream: OutputStream, format: ImageFormat, width: int, height: int, quality: int) → boolean | Renders the next page to a stream with explicit dimensions and JPEG quality. |
getNextImage(outputFile: String, format: ImageFormat, width: double, height: double, quality: int) → boolean | Double-width/height file overload (matches C# API signature). |
getNextImage(outputFile: String, pageSize: PageSize) → boolean | PageSize overload: renders the next page at the given page size (default JPEG). |
getNextImage(stream: OutputStream, pageSize: PageSize, format: ImageFormat) → boolean | PageSize + format overload — stream version. |
getNextImage(stream: OutputStream, format: ImageFormat, width: double, height: double, quality: int) → boolean | Double-width/height stream overload (matches C# API signature). |
saveAsTIFF(outputFile: String) → boolean | Saves all pages of the bound document as a single multi-page TIFF file. |
saveAsTIFF(outputFile: String, settings: TiffSettings) → boolean | Saves all pages of the bound document as a multi-page TIFF with settings. |
saveAsTIFF(outputFile: String, settings: TiffSettings, resolution: Resolution) → boolean | Saves all pages as a multi-page TIFF with settings and explicit resolution. |
saveAsTIFF(stream: OutputStream, settings: TiffSettings) → boolean | Saves all pages as a multi-page TIFF to an output stream. |
saveAsTIFF(outputFile: String, compression: CompressionType) → boolean | Saves all pages as multi-page TIFF with the given compression type. |
saveAsTIFF(outputFile: String, pageSize: PageSize, settings: TiffSettings) → boolean | Saves all pages as a multi-page TIFF fitted to the specified page size. |
saveAsTIFF(stream: OutputStream, pageSize: PageSize, settings: TiffSettings) → boolean | Saves all pages as a multi-page TIFF fitted to the specified page size. |
saveAsTIFF(outputFile: String, width: int, height: int) → boolean | Saves all pages as multi-page TIFF scaled to the given pixel dimensions. |
saveAsTIFF(outputFile: String, width: int, height: int, compression: CompressionType) → boolean | Saves all pages as multi-page TIFF scaled to the given dimensions with compression. |
saveAsTIFF(outputFile: String, width: int, height: int, settings: TiffSettings) → boolean | Saves all pages as multi-page TIFF scaled to the given dimensions with settings. |
saveAsTIFF(stream: OutputStream, width: int, height: int, settings: TiffSettings) → boolean | Stream overload with explicit target dimensions and settings. |
saveAsTIFFClassF(outputFile: String) → boolean | Saves all pages as TIFF Class F (B/W fax format, CCITT4 compression). |
saveAsTIFFClassF(outputFile: String, width: int, height: int) → boolean | TIFF Class F with target dimensions. |
close() | Closes the converter and releases the bound document. |