Enterprise Information Portal APIs

com.ibm.mm.viewer
Class CMBDocument

java.lang.Object
  |
  +--com.ibm.mm.viewer.CMBDocument
All Implemented Interfaces:
CMBViewerConstants, java.io.Serializable

public class CMBDocument
extends java.lang.Object
implements CMBViewerConstants, java.io.Serializable

CMBDocument represents a document parsed by CMBDocumentServices. Properties are provided to query and control general aspects of the document, such as the number of pages and scale. An array property provides access to CMBPage objects which represent the pages of the document.

There is no public constructor for CMBDocument. Use CMBDocumentServices.loadDocument() to obtain an instance of CMBDocument.

Since:
7.1
See Also:
Serialized Form

Fields inherited from interface com.ibm.mm.viewer.CMBViewerConstants
DEFAULT_PAGE_NUMBER, ROTATE_0, ROTATE_180, ROTATE_270, ROTATE_90
 
Method Summary
 boolean getCanEnhance()
          Returns true if the document can be enhanced.
 boolean getCanInvert()
          Returns true if the document pages can be color-inverted.
 boolean getCanPaginate()
          Returns true if individual pages of the document can be obtained.
 boolean getCanPrint()
          Returns true if the document can be printed using print().
 boolean getCanRotate()
          Returns true if the document can be rotated.
 boolean getCanShowAnnotations()
          Returns true if annotations stored with the document can be displayed on the document pages.
 boolean getCanWrite()
          Returns true if the document can be written in one of the preferred formats or if the document can be written in its original format.
 boolean getEnhance()
          Returns the current enhance of the document.
 int getImageResolution()
          Returns the image resolution of the document in pixels per inch (ppi).
 boolean getInvert()
          Returns the current invert setting of the document.
 java.lang.String getMimeType()
          Returns the MIME content type of the document.
 int getPageCount()
          Returns the number of pages in the document.
 CMBPage[] getPages()
          Returns an array of CMBPage objects for all pages of the document.
 CMBPage getPages(int index)
          Returns a CMBPage object for a particular page of the document.
 double getPreferredScale()
          Returns the preferred scale for pages of the document.
 int getRotation()
          Returns the current rotation of the document.
 boolean getShowAnnotations()
          Returns the current setting for annotations.
 java.lang.String getWriteMimeType()
          Return the Mime type for the format that the document will be written when using CMBDocument.write.
 void print(java.awt.PrintJob printJob, boolean withAnnotations)
          Print the document (all pages).
 void setEnhance(boolean enhance)
          Set the enhance of the document
 void setInvert(boolean invert)
          Sets the invert of the document.
 void setPreferredScale(double scale)
          Sets the preferred scale for pages of the document.
 void setRotation(int rotation)
          Sets the rotation of the document.
 void setShowAnnotations(boolean withAnnotations)
          Sets annotations showing.
 void write(java.io.OutputStream outStream)
          Writes the document to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMimeType

public java.lang.String getMimeType()
Returns the MIME content type of the document.

getCanPaginate

public boolean getCanPaginate()
Returns true if individual pages of the document can be obtained. If this returns false, the page count will be zero.

getPageCount

public int getPageCount()
                 throws java.io.IOException
Returns the number of pages in the document.

Note: For large documents, calling this method may require that all parts of the document be retrieved from the server and processed, which could be time consuming.


getPages

public CMBPage[] getPages()
                   throws java.io.IOException
Returns an array of CMBPage objects for all pages of the document.

Note: For large documents, calling this method may require that all parts of the document be retrieved from the server and processed, which could be time consuming.


getPages

public CMBPage getPages(int index)
                 throws java.lang.ArrayIndexOutOfBoundsException,
                        java.io.IOException
Returns a CMBPage object for a particular page of the document.
Parameters:
index - the index of the page (zero is the first page).
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is not a valid index of a page.

getPreferredScale

public double getPreferredScale()
Returns the preferred scale for pages of the document. The actual scale of the document pages may be different, due to limitations on scaling by document engines. Use CMBPage.getScale() to determine the actual scale for a particular page.

setPreferredScale

public void setPreferredScale(double scale)
Sets the preferred scale for pages of the document. The actual scale of the document pages may be different, due to limitations on scaling by document engines. Use CMBPage.getScale() to determine the actual scale for a particular page.
Parameters:
scale - the new preferred scale.

getCanRotate

public boolean getCanRotate()
Returns true if the document can be rotated. If the document cannot be paginated, false is returned.

getRotation

public int getRotation()
Returns the current rotation of the document.

setRotation

public void setRotation(int rotation)
Sets the rotation of the document.
Parameters:
rotation - one of four values: ROTATE_0, ROTATE_90, ROTATE_180, or ROTATE_270.

getCanEnhance

public boolean getCanEnhance()
Returns true if the document can be enhanced. Enhancement modifies a document page in order to make the text more readable. If the document cannot be rotated, false is returned.

getEnhance

public boolean getEnhance()
Returns the current enhance of the document.

setEnhance

public void setEnhance(boolean enhance)
Set the enhance of the document
Parameters:
enhance - if true, the document is enhanced

getCanInvert

public boolean getCanInvert()
Returns true if the document pages can be color-inverted. If the document cannot be paginated, false is returned.

getInvert

public boolean getInvert()
Returns the current invert setting of the document.

setInvert

public void setInvert(boolean invert)
Sets the invert of the document.
Parameters:
invert - if true, the document is color-inverted.

getCanShowAnnotations

public boolean getCanShowAnnotations()
Returns true if annotations stored with the document can be displayed on the document pages. If the document cannot be paginated, false is returned.

getShowAnnotations

public boolean getShowAnnotations()
Returns the current setting for annotations.

setShowAnnotations

public void setShowAnnotations(boolean withAnnotations)
Sets annotations showing.
Parameters:
withAnnotations - If true, annotations stored with the document will be displayed on the pages of the document.

getCanPrint

public boolean getCanPrint()
Returns true if the document can be printed using print(). This is currently true only for documents whose pages can be displayed as Java images by the underlying document engines.

getWriteMimeType

public java.lang.String getWriteMimeType()
Return the Mime type for the format that the document will be written when using CMBDocument.write. This format is determined by the capabilities of the underlying document conversion engines, the preferred format (specified using CMBDocumentServices.setPreferredFormats), and the conversion properties (specified using CMBDocumentServices.setConversionProperties). If the document cannot be written in a preferred format or its original format, null is returned.

getImageResolution

public int getImageResolution()
Returns the image resolution of the document in pixels per inch (ppi).
Returns:
int the image resolution in pixels per inch.

print

public void print(java.awt.PrintJob printJob,
                  boolean withAnnotations)
           throws CMBDocumentEngineException,
                  java.io.IOException
Print the document (all pages). The current settings for scale, rotation, enhance, and show annotations are ignored.

Note: Print is only supported for documents whose pages can be displayed as Java images by the underlying document engines.

Parameters:
printJob - the document pages are printed to this print job. The print job is not closed, so the caller should close the print job using PrintJob.end().
withAnnotations - if true, the annotations are also printed.

getCanWrite

public boolean getCanWrite()
Returns true if the document can be written in one of the preferred formats or if the document can be written in its original format. Otherwise, returns false.

write

public void write(java.io.OutputStream outStream)
           throws CMBDocumentEngineException,
                  java.io.IOException
Writes the document to the output stream.
Parameters:
outStream - the output stream where the document is written.

EIP JavaBeans

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.