Viewer

Inheritance: java.lang.Object

All Implemented Interfaces: java.io.Closeable

public class Viewer implements Closeable

Represents main class that controls document rendering process.

Constructors

Constructor Description
Viewer(InputStream fileStream) Initializes new instance of Viewer class.
Viewer(InputStream fileStream, boolean leaveOpen) Initializes new instance of Viewer class.
Viewer(InputStream fileStream, LoadOptions loadOptions) Initializes new instance of Viewer class.
Viewer(InputStream fileStream, LoadOptions loadOptions, boolean leaveOpen) Initializes new instance of Viewer class.
Viewer(InputStream inputStream, LoadOptions loadOptions, ViewerSettings settings) Initializes new instance of Viewer class.
Viewer(InputStream inputStream, LoadOptions loadOptions, ViewerSettings settings, boolean leaveOpen) Initializes new instance of Viewer class.
Viewer(InputStream inputStream, ViewerSettings settings) Initializes new instance of Viewer class.
Viewer(InputStream inputStream, ViewerSettings settings, boolean leaveOpen) Initializes new instance of class.
Viewer(FileReader fileReader, ViewerSettings settings) Initializes new instance of Viewer class.
Viewer(FileReader fileReader, LoadOptions loadOptions, ViewerSettings settings) Initializes new instance of Viewer class.
Viewer(String filePath) Initializes new instance of Viewer class.
Viewer(Path filePath) Initializes new instance of Viewer class.
Viewer(String filePath, LoadOptions loadOptions) Initializes new instance of Viewer class.
Viewer(Path filePath, LoadOptions loadOptions) Initializes new instance of Viewer class.
Viewer(String filePath, ViewerSettings settings) Initializes new instance of Viewer class.
Viewer(Path filePath, ViewerSettings settings) Initializes new instance of Viewer class.
Viewer(String filePath, LoadOptions loadOptions, ViewerSettings settings) Initializes new instance of Viewer class.
Viewer(Path filePath, LoadOptions loadOptions, ViewerSettings settings) Initializes new instance of Viewer class.

Methods

Method Description
getViewInfo(ViewInfoOptions options) Returns information about view and document specific information.
getAttachments() Returns attachments contained by the document.
saveAttachment(Attachment attachment, OutputStream destination) Saves attachment file to destination stream.
view(ViewOptions options) Creates view of all document pages.
view(ViewOptions options, int[] pageNumbers) Creates view of specific document pages.
getFileInfo() Returns information about file such as file-type and flag that indicates if file is encrypted.
close() Releases file stream and managed internal resources.

Viewer(InputStream fileStream)

public Viewer(InputStream fileStream)

Initializes new instance of Viewer class.

More about file types supported by GroupDocs.Viewer: Document formats supported by GroupDocs.Viewer

Parameters:

Parameter Type Description
fileStream java.io.InputStream The method that returns readable stream.

Viewer(InputStream fileStream, boolean leaveOpen)

public Viewer(InputStream fileStream, boolean leaveOpen)

Initializes new instance of Viewer class.

Learn more

Parameters:

Parameter Type Description
fileStream java.io.InputStream The file stream.
leaveOpen boolean true to leave the stream open after the Viewer object is disposed; otherwise, false

Viewer(InputStream fileStream, LoadOptions loadOptions)

public Viewer(InputStream fileStream, LoadOptions loadOptions)

Initializes new instance of Viewer class.

Learn more

Parameters:

Parameter Type Description
fileStream java.io.InputStream The readable stream.
loadOptions LoadOptions The document load options.

Viewer(InputStream fileStream, LoadOptions loadOptions, boolean leaveOpen)

public Viewer(InputStream fileStream, LoadOptions loadOptions, boolean leaveOpen)

Initializes new instance of Viewer class.

Learn more

Parameters:

Parameter Type Description
fileStream java.io.InputStream The file stream.
loadOptions LoadOptions The document load options.
leaveOpen boolean true to leave the stream open after the Viewer object is disposed; otherwise, false

Viewer(InputStream inputStream, LoadOptions loadOptions, ViewerSettings settings)

public Viewer(InputStream inputStream, LoadOptions loadOptions, ViewerSettings settings)

Initializes new instance of Viewer class.

Learn more

Parameters:

Parameter Type Description
inputStream java.io.InputStream The file stream
loadOptions LoadOptions The document load options.
settings ViewerSettings The Viewer settings.

Viewer(InputStream inputStream, LoadOptions loadOptions, ViewerSettings settings, boolean leaveOpen)

public Viewer(InputStream inputStream, LoadOptions loadOptions, ViewerSettings settings, boolean leaveOpen)

Initializes new instance of Viewer class.

Learn more

Parameters:

Parameter Type Description
inputStream java.io.InputStream The file stream.
loadOptions LoadOptions The document load options.
settings ViewerSettings The Viewer settings.
leaveOpen boolean true to leave the stream open after the Viewer object is disposed; otherwise, false

Viewer(InputStream inputStream, ViewerSettings settings)

public Viewer(InputStream inputStream, ViewerSettings settings)

Initializes new instance of Viewer class.

Learn more

Parameters:

Parameter Type Description
inputStream java.io.InputStream The file stream
settings ViewerSettings The Viewer settings.

Viewer(InputStream inputStream, ViewerSettings settings, boolean leaveOpen)

public Viewer(InputStream inputStream, ViewerSettings settings, boolean leaveOpen)

Initializes new instance of class.

Parameters:

Parameter Type Description
inputStream java.io.InputStream The file stream.
settings ViewerSettings The Viewer settings.
leaveOpen boolean true to leave the stream open after the Viewer object is disposed; otherwise, false

Viewer(FileReader fileReader, ViewerSettings settings)

public Viewer(FileReader fileReader, ViewerSettings settings)

Initializes new instance of Viewer class.

Parameters:

Parameter Type Description
fileReader FileReader The file reader
settings ViewerSettings The Viewer settings.

Viewer(FileReader fileReader, LoadOptions loadOptions, ViewerSettings settings)

public Viewer(FileReader fileReader, LoadOptions loadOptions, ViewerSettings settings)

Initializes new instance of Viewer class.

Parameters:

Parameter Type Description
fileReader FileReader The file reader.
loadOptions LoadOptions The load options.
settings ViewerSettings The Viewer settings.

Viewer(String filePath)

public Viewer(String filePath)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.lang.String The path to the file to render.

Viewer(Path filePath)

public Viewer(Path filePath)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.nio.file.Path The path to the file to render.

Viewer(String filePath, LoadOptions loadOptions)

public Viewer(String filePath, LoadOptions loadOptions)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.lang.String The path to the file to render.
loadOptions LoadOptions The document load options.

Viewer(Path filePath, LoadOptions loadOptions)

public Viewer(Path filePath, LoadOptions loadOptions)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.nio.file.Path The path to the file to render.
loadOptions LoadOptions The document load options.

Viewer(String filePath, ViewerSettings settings)

public Viewer(String filePath, ViewerSettings settings)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.lang.String The path to the file to render.
settings ViewerSettings The Viewer settings.

Viewer(Path filePath, ViewerSettings settings)

public Viewer(Path filePath, ViewerSettings settings)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.nio.file.Path The path to the file to render.
settings ViewerSettings The Viewer settings.

Viewer(String filePath, LoadOptions loadOptions, ViewerSettings settings)

public Viewer(String filePath, LoadOptions loadOptions, ViewerSettings settings)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.lang.String The path to the file to render.
loadOptions LoadOptions The document load options.
settings ViewerSettings The Viewer settings.

Viewer(Path filePath, LoadOptions loadOptions, ViewerSettings settings)

public Viewer(Path filePath, LoadOptions loadOptions, ViewerSettings settings)

Initializes new instance of Viewer class.

Note: Learn more

Parameters:

Parameter Type Description
filePath java.nio.file.Path The path to the file to render.
loadOptions LoadOptions The document load options.
settings ViewerSettings The Viewer settings.

getViewInfo(ViewInfoOptions options)

public final ViewInfo getViewInfo(ViewInfoOptions options)

Returns information about view and document specific information.

Learn more

Parameters:

Parameter Type Description
options ViewInfoOptions The view info options.

Returns: ViewInfo - Information about view and document specific information.

getAttachments()

public final List<Attachment> getAttachments()

Returns attachments contained by the document.

Learn more

Returns: java.util.List<com.groupdocs.viewer.results.Attachment> - Attachments contained by the document.

saveAttachment(Attachment attachment, OutputStream destination)

public void saveAttachment(Attachment attachment, OutputStream destination)

Saves attachment file to destination stream.

Learn more

Parameters:

Parameter Type Description
attachment Attachment The attachment.
destination java.io.OutputStream The writable stream.

view(ViewOptions options)

public final void view(ViewOptions options)

Creates view of all document pages.

Learn more

Parameters:

Parameter Type Description
options ViewOptions The view options.

view(ViewOptions options, int[] pageNumbers)

public final void view(ViewOptions options, int[] pageNumbers)

Creates view of specific document pages.

Learn more

Parameters:

Parameter Type Description
options ViewOptions The view options.
pageNumbers int[] The page numbers to view.

getFileInfo()

public FileInfo getFileInfo()

Returns information about file such as file-type and flag that indicates if file is encrypted. Learn more about file information: How to check if file is encrypted

Returns: FileInfo - The file information.

close()

public final void close()

Releases file stream and managed internal resources.