public class Viewer extends Object implements Closeable
Represents main class that controls document rendering process.
Constructor and Description |
---|
Viewer(FileReader fileReader,
LoadOptions loadOptions,
ViewerSettings settings)
Initializes new instance of
Viewer class. |
Viewer(FileReader fileReader,
ViewerSettings settings)
Initializes new instance of
Viewer class. |
Viewer(InputStream fileStream)
Initializes new instance of
Viewer class. |
Viewer(InputStream fileStream,
LoadOptions loadOptions)
Initializes new instance of
Viewer class. |
Viewer(InputStream inputStream,
ViewerSettings settings)
Initializes new instance of
Viewer class. |
Viewer(String filePath)
Initializes new instance of
Viewer class. |
Viewer(String filePath,
LoadOptions loadOptions)
Initializes new instance of
Viewer class. |
Viewer(String filePath,
LoadOptions loadOptions,
ViewerSettings settings)
Initializes new instance of
Viewer class. |
Viewer(String filePath,
ViewerSettings settings)
Initializes new instance of
Viewer class. |
Modifier and Type | Method and Description |
---|---|
static void |
clearTempFiles()
Removes temporary files created during rendering.
|
void |
close()
Releases file stream and managed internal resources.
|
protected void |
close(boolean disposing)
Releases file stream and managed internal resources.
|
List<Attachment> |
getAttachments()
Returns attachments contained by the document.
|
ViewInfo |
getViewInfo(ViewInfoOptions options)
Returns information about view and document specific information.
|
void |
saveAttachment(String attachmentId,
OutputStream destination)
Saves attachment file to
destination stream. |
void |
view(ViewOptions options)
Creates view of all document pages.
|
void |
view(ViewOptions options,
int... pageNumbers)
Creates view of specific document pages.
|
public Viewer(FileReader fileReader, LoadOptions loadOptions, ViewerSettings settings)
Initializes new instance of Viewer
class.
fileReader
- The file reader.loadOptions
- The load options.settings
- The Viewer settings.IllegalArgumentException
- Thrown when fileReader
is null.IllegalArgumentException
- Thrown when loadOptions
is null.IllegalArgumentException
- Thrown when settings
is null.public Viewer(FileReader fileReader, ViewerSettings settings)
Initializes new instance of Viewer
class.
fileReader
- The file readersettings
- The Viewer settings.IllegalArgumentException
- Thrown when fileReader
is null.IllegalArgumentException
- Thrown when settings
is null.public Viewer(InputStream fileStream)
Initializes new instance of Viewer
class.
fileStream
- The method that returns readable stream.IllegalArgumentException
- Thrown when fileStream
is null.public Viewer(InputStream fileStream, LoadOptions loadOptions)
Initializes new instance of Viewer
class.
fileStream
- The readable stream.loadOptions
- The document load options.IllegalArgumentException
- Thrown when fileStream
is null.IllegalArgumentException
- Thrown when loadOptions
is null.public Viewer(InputStream inputStream, ViewerSettings settings)
Initializes new instance of Viewer
class.
inputStream
- The file streamsettings
- The Viewer settings.IllegalArgumentException
- Thrown when inputStream
is null.IllegalArgumentException
- Thrown when settings
is null.public Viewer(String filePath) throws FileNotFoundException
Initializes new instance of Viewer
class.
filePath
- The path to the file to render.FileNotFoundException
- Thrown when file can not be found or can not be read.IllegalArgumentException
- Thrown when filePath
is null or empty.public Viewer(String filePath, LoadOptions loadOptions) throws FileNotFoundException
Initializes new instance of Viewer
class.
filePath
- The path to the file to render.loadOptions
- The document load options.FileNotFoundException
- Thrown when file can not be found or can not be read.IllegalArgumentException
- Thrown when filePath
is null or empty.IllegalArgumentException
- Thrown when loadOptions
is null.public Viewer(String filePath, LoadOptions loadOptions, ViewerSettings settings)
Initializes new instance of Viewer
class.
filePath
- The path to the file to render.loadOptions
- The document load options.settings
- The Viewer settings.IllegalArgumentException
- Thrown when filePath
is null or empty.IllegalArgumentException
- Thrown when loadOptions
is null.IllegalArgumentException
- Thrown when settings
is null.public Viewer(String filePath, ViewerSettings settings)
Initializes new instance of Viewer
class.
filePath
- The path to the file to render.settings
- The Viewer settings.IllegalArgumentException
- Thrown when filePath
is null or empty.IllegalArgumentException
- Thrown when settings
is null.public static void clearTempFiles()
Removes temporary files created during rendering.
public final void close()
Releases file stream and managed internal resources.
close
in interface Closeable
close
in interface AutoCloseable
protected void close(boolean disposing)
Releases file stream and managed internal resources.
disposing
- Indicates from which method (Dispose or Finalize) this method is called.public final List<Attachment> getAttachments() throws PasswordRequiredException, IncorrectPasswordException
Returns attachments contained by the document.
PasswordRequiredException
- Thrown when password is required to open
the document.IncorrectPasswordException
- Thrown when password that was specified is
incorrect.public final ViewInfo getViewInfo(ViewInfoOptions options) throws IllegalArgumentException, PasswordRequiredException, IncorrectPasswordException
Returns information about view and document specific information.
options
- The view info options.IllegalArgumentException
- Thrown when options
is null.PasswordRequiredException
- Thrown when password is required to open
the document.IncorrectPasswordException
- Thrown when password that was specified is
incorrect.public final void saveAttachment(String attachmentId, OutputStream destination)
Saves attachment file to destination
stream.
attachmentId
- The attachment ID.destination
- The writable stream.IllegalArgumentException
- Thrown when attachmentId
is null or empty.IllegalArgumentException
- Thrown when destination
is null.PasswordRequiredException
- Thrown when password is required to open the document.IncorrectPasswordException
- Thrown when password that was specified is incorrect.GroupDocsViewerException
- Thrown when attachment could not be found.public final void view(ViewOptions options)
Creates view of all document pages.
options
- The view options.IllegalArgumentException
- Thrown when options
is null.PasswordRequiredException
- Thrown when password is required to open the document.IncorrectPasswordException
- Thrown when password that was specified is incorrect.GroupDocsViewerException
- Thrown when attachment could not be found.public final void view(ViewOptions options, int... pageNumbers)
Creates view of specific document pages.
options
- The view options.pageNumbers
- The page numbers to view.IllegalArgumentException
- Thrown when options
is null.IllegalArgumentException
- Thrown when pageNumbers
is null or empty.PasswordRequiredException
- Thrown when password is required to open the document.IncorrectPasswordException
- Thrown when password that was specified is incorrect.GroupDocsViewerException
- Thrown when attachment could not be found.