PdfViewer

Overview

PdfViewer is a class in Aspose.Pdf FOSS for Java. Inherits from: Printable, AutoCloseable.

Facade for viewing and printing PDF documents.

Properties

NameTypeAccessDescription
autoResizebooleanReadReturns whether pages are auto-resized to fit the paper.
autoRotatebooleanReadReturns whether pages are auto-rotated to best fit.
printPageDialogbooleanReadReturns whether a print dialog is shown before printing.
printAsGrayscalebooleanReadReturns whether to print in grayscale.
resolutionintReadReturns the rendering resolution in DPI.
useIntermidiateImagebooleanReadReturns whether intermediate image is used.

Methods

SignatureDescription
PdfViewer()Creates a new PdfViewer instance.
bindPdf(inputFile: String)Binds a PDF file to this viewer.
bindPdf(stream: InputStream)Binds a PDF from an input stream.
bindPdf(doc: Document)Binds an existing Document to this viewer.
openPdfFile(inputFile: String)Opens a PDF file (alias for bindPdf).
printDocumentWithSettings(pageSettings: PrintPageSettings, printerSettings: PdfPrinterSettings)Prints the document with specified page and printer settings.
printDocumentWithSettings(printerSettings: PdfPrinterSettings)Prints the document with the specified printer settings using default page settings.
printDocument()Prints the document using default settings.
printLargePdf(inputFile: String)Prints a large PDF file (binds and prints).
decodePage(pageNum: int)BufferedImageRenders a single page to a BufferedImage.
decodeAllPages()BufferedImage[]Renders all pages to BufferedImage array.
print(g: Graphics, pf: PageFormat, pageIndex: int)int
isAutoResize()booleanReturns whether pages are auto-resized to fit the paper.
setAutoResize(v: boolean)Sets whether pages are auto-resized to fit the paper.
isAutoRotate()booleanReturns whether pages are auto-rotated to best fit.
setAutoRotate(v: boolean)Sets whether pages are auto-rotated.
isPrintPageDialog()booleanReturns whether a print dialog is shown before printing.
setPrintPageDialog(v: boolean)Sets whether a print dialog is shown.
isPrintAsGrayscale()booleanReturns whether to print in grayscale.
setPrintAsGrayscale(v: boolean)Sets whether to print in grayscale.
getResolution()intReturns the rendering resolution in DPI.
setResolution(v: int)Sets the rendering resolution in DPI.
setUseIntermidiateImage(v: boolean)Sets whether to use an intermediate image for printing.
isUseIntermidiateImage()booleanReturns whether intermediate image is used.
closePdfFile()Closes the PDF file (alias for close).
close()

See Also