PdfConverter

Overview

PdfConverter is a class in Aspose.Pdf FOSS for Java. Inherits from: AutoCloseable.

Converts PDF pages to raster images (JPEG, PNG).

Properties

NameTypeAccessDescription
documentDocumentReadReturns the currently bound document.
pageCountintReadReturns the total number of pages in the bound document.
startPageintReadReturns the start page, or 0 if unset.
endPageintReadReturns the end page, or 0 if unset.
resolutionResolutionReadReturns the current resolution.
coordinateTypePageCoordinateTypeReadReturns which page box should be used as the coordinate space.

Methods

SignatureDescription
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)booleanBinds a PDF file to this converter.
bindPdf(inputStream: InputStream)booleanBinds a PDF from an input stream.
bindPdf(document: Document)booleanBinds an existing {@link Document} to this converter.
getDocument()DocumentReturns the currently bound document.
setResolution(resolution: Resolution)Sets the resolution for image rendering.
doConvert()booleanInitializes the conversion process by resetting the page counter.
getPageCount()intReturns 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()intReturns the start page, or 0 if unset.
getEndPage()intReturns the end page, or 0 if unset.
getResolution()ResolutionReturns the current resolution.
getCoordinateType()PageCoordinateTypeReturns 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()booleanReturns whether there are more pages to convert.
getNextImage(outputFile: String, format: String)booleanRenders the next page to an image file.
getNextImage(stream: OutputStream, format: String)booleanRenders the next page to an output stream.
getNextImage(outputFile: String, format: ImageFormat)booleanRenders the next page to an image file using the given {@link ImageFormat}.
getNextImage(outputFile: String, format: ImageFormat, quality: int)booleanRenders the next page to an image file with explicit JPEG quality.
getNextImage(stream: OutputStream, format: ImageFormat)booleanRenders the next page to an output stream using the given {@link ImageFormat}.
getNextImage(stream: OutputStream, format: ImageFormat, quality: int)booleanRenders the next page to an output stream with explicit JPEG quality.
getNextImage(outputFile: String)booleanRenders the next page to a file using default JPEG format.
getNextImage(stream: OutputStream)booleanRenders the next page to a stream using default JPEG format.
getNextImage(outputFile: String, format: ImageFormat, width: int, height: int)booleanRenders the next page to a file with explicit output dimensions.
getNextImage(outputFile: String, format: ImageFormat, width: int, height: int, quality: int)booleanRenders the next page to a file with explicit dimensions and JPEG quality.
getNextImage(stream: OutputStream, format: ImageFormat, width: int, height: int)booleanRenders the next page to a stream with explicit output dimensions.
getNextImage(stream: OutputStream, format: ImageFormat, width: int, height: int, quality: int)booleanRenders the next page to a stream with explicit dimensions and JPEG quality.
getNextImage(outputFile: String, format: ImageFormat, width: double, height: double, quality: int)booleanDouble-width/height file overload (matches C# API signature).
getNextImage(outputFile: String, pageSize: PageSize)booleanPageSize overload: renders the next page at the given page size (default JPEG).
getNextImage(stream: OutputStream, pageSize: PageSize, format: ImageFormat)booleanPageSize + format overload — stream version.
getNextImage(stream: OutputStream, format: ImageFormat, width: double, height: double, quality: int)booleanDouble-width/height stream overload (matches C# API signature).
saveAsTIFF(outputFile: String)booleanSaves all pages of the bound document as a single multi-page TIFF file.
saveAsTIFF(outputFile: String, settings: TiffSettings)booleanSaves all pages of the bound document as a multi-page TIFF with settings.
saveAsTIFF(outputFile: String, settings: TiffSettings, resolution: Resolution)booleanSaves all pages as a multi-page TIFF with settings and explicit resolution.
saveAsTIFF(stream: OutputStream, settings: TiffSettings)booleanSaves all pages as a multi-page TIFF to an output stream.
saveAsTIFF(outputFile: String, compression: CompressionType)booleanSaves all pages as multi-page TIFF with the given compression type.
saveAsTIFF(outputFile: String, pageSize: PageSize, settings: TiffSettings)booleanSaves all pages as a multi-page TIFF fitted to the specified page size.
saveAsTIFF(stream: OutputStream, pageSize: PageSize, settings: TiffSettings)booleanSaves all pages as a multi-page TIFF fitted to the specified page size.
saveAsTIFF(outputFile: String, width: int, height: int)booleanSaves all pages as multi-page TIFF scaled to the given pixel dimensions.
saveAsTIFF(outputFile: String, width: int, height: int, compression: CompressionType)booleanSaves all pages as multi-page TIFF scaled to the given dimensions with compression.
saveAsTIFF(outputFile: String, width: int, height: int, settings: TiffSettings)booleanSaves all pages as multi-page TIFF scaled to the given dimensions with settings.
saveAsTIFF(stream: OutputStream, width: int, height: int, settings: TiffSettings)booleanStream overload with explicit target dimensions and settings.
saveAsTIFFClassF(outputFile: String)booleanSaves all pages as TIFF Class F (B/W fax format, CCITT4 compression).
saveAsTIFFClassF(outputFile: String, width: int, height: int)booleanTIFF Class F with target dimensions.
close()Closes the converter and releases the bound document.

See Also