|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.intarsys.pdf.cos.COSDocument
public class COSDocument
This is a COS level representation of a pdf document. A COS document is made
up of a collection of COSObject
instances. These objects are arranged
according to the PDF file format specification.
See PDF File Format Specification [PDF].
Field Summary | |
---|---|
static Object |
SLOT_DIRTY
|
static Object |
SLOT_LOCATOR
|
static Object |
SLOT_TRAILER
|
Method Summary | |
---|---|
void |
add(COSDocumentElement element)
This should not be used by the application programmer. |
void |
addDocumentListener(ICOSDocumentListener listener)
Add an ICOSDocumentListener to be informed about the documents
events. |
void |
addMonitor(ICOSMonitor listener)
|
ICOSContainer |
associate(ICOSContainer newContainer,
COSObject object)
This method should not be used by the application programmer. |
void |
close()
Close the document. |
COSDocumentElement |
containable(COSObject object)
This method should not be used by the application programmer. |
COSDocument |
copyDeep()
Make a deep copy of the receiver. |
static COSDocument |
createFromLocator(ILocator locator)
Create a COSDocument based on a Locator. |
static COSDocument |
createFromST(STDocument doc)
Create a COSDocument based on a STDocument. |
static COSDocument |
createNew()
Create a new empty pdf COSDocument. |
static COSDocument |
createNew(STDocType docType)
Create a new empty COSDocument. |
ICOSContainer |
disassociate(ICOSContainer oldContainer,
COSObject object)
This method should not be used by the application programmer. |
IAccessPermissions |
getAccessPermissions()
If a document contains a permissions dictionary, it is "pushed" to this by the parser. |
Object |
getAttribute(Object key)
get an attribute from the context |
COSCatalog |
getCatalog()
Get the root object (the catalog) for the document. |
COSDocument |
getDoc()
This method should not be used by the application programmer. |
int |
getIncrementalCount()
The number of versions created for this document so far. |
COSInfoDict |
getInfoDict()
Get the info dictionary containing metadata. |
ILocator |
getLocator()
The ILocator for this document. |
String |
getName()
The document name. |
EnumWriteMode |
getWriteModeHint()
The write mode to be used when the document is written the next time. |
void |
handleException(COSRuntimeException ex)
Handle ex , optionally rethrow. |
boolean |
isDirty()
Answer true if the document has changes to be commited. |
boolean |
isEncrypted()
Answer true if the document is encrypted. |
boolean |
isNew()
Answer true if the document is new, i.e. not yet written. |
boolean |
isReadOnly()
Answer true if the document is read only. |
Iterator |
objects()
An iterator on all COSObject instances of this that are managed as indirect objects in the storage layer. |
int |
referenceCount()
This method should not be used by the application programmer. |
COSIndirectObject |
referenceIndirect(COSObject object)
This method should not be used by the application programmer. |
void |
register(COSDocumentElement object)
This method should not be used by the application programmer. |
Object |
removeAttribute(Object key)
remove an attribute in the context |
void |
removeDocumentListener(ICOSDocumentListener listener)
Remove an ICOSDocumentListener . |
void |
removeMonitor(ICOSMonitor monitor)
|
void |
restore(ILocator locator)
Restore this from a locator. |
ICOSContainer |
restoreStateContainer(ICOSContainer container)
This method should not be used by the application programmer. |
void |
save()
Save the document to its current ILocator . |
void |
save(ILocator locator)
Save the document nto a new ILocator . |
void |
save(ILocator locator,
Map options)
Save the document to an optional new ILocator using the
options to control specific serializing behavior such as
"incremental writing". |
ICOSContainer |
saveStateContainer()
This method should not be used by the application programmer. |
Object |
setAttribute(Object key,
Object value)
set the value of an attribute in the context |
void |
setInfoDict(COSInfoDict infoDict)
Set the info dictionary containing metadata. |
void |
setName(String name)
Assign a new name to the document. |
void |
setWriteModeHint(EnumWriteMode writeMode)
The write mode to be used when the document is written the next time. |
STDocument |
stGetDoc()
The storage layer document. |
void |
triggerChangedAll()
This method should not be used by the application programmer. |
void |
willChange(COSObject change)
This method should not be used by the application programmer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object SLOT_DIRTY
public static final Object SLOT_TRAILER
public static final Object SLOT_LOCATOR
Method Detail |
---|
public static COSDocument createFromLocator(ILocator locator) throws IOException, COSLoadException
locator
- The ILocater referencing the documents data stream.
COSLoadException
IOException
public static COSDocument createFromST(STDocument doc) throws COSLoadException
doc
- The storage layer document.
COSLoadException
public static COSDocument createNew()
public static COSDocument createNew(STDocType docType)
public void add(COSDocumentElement element)
public
for package visibility reasons.
element
- public void addMonitor(ICOSMonitor listener)
public void addDocumentListener(ICOSDocumentListener listener)
ICOSDocumentListener
to be informed about the documents
events.
listener
- THe new listenerpublic ICOSContainer associate(ICOSContainer newContainer, COSObject object)
COSObject
lifecycle to ensure internal consistency.
associate
in interface ICOSContainer
ICOSContainer
for object
public void close() throws IOException
close
.
IOException
public COSDocumentElement containable(COSObject object)
COSObject
lifecycle to ensure internal consistency.
containable
in interface ICOSContainer
object
- THe object whose containable is requested.
public COSDocument copyDeep()
public ICOSContainer disassociate(ICOSContainer oldContainer, COSObject object)
COSObject
lifecycle to ensure internal consistency.
disassociate
in interface ICOSContainer
ICOSContainer
for object
public IAccessPermissions getAccessPermissions()
public Object getAttribute(Object key)
IAttributeSupport
getAttribute
in interface IAttributeSupport
key
- the name of the attribute to get
public COSCatalog getCatalog()
public COSDocument getDoc()
COSObject
lifecycle to ensure internal consistency.
getDoc
in interface ICOSContainer
public int getIncrementalCount()
public COSInfoDict getInfoDict()
public ILocator getLocator()
ILocator
for this document. The ILocator
designates
the physical storage for the PDF data.
getLocator
in interface ILocatorSupport
ILocator
for this document.public String getName()
ILocator
.
public EnumWriteMode getWriteModeHint()
public void handleException(COSRuntimeException ex) throws COSRuntimeException
ICOSExceptionHandler
ex
, optionally rethrow.
handleException
in interface ICOSExceptionHandler
ex
- The exceptioin to be handeled.
COSRuntimeException
public boolean isDirty()
true
if the document has changes to be commited.
true
if the document has changes to be
commited.public boolean isEncrypted()
true
if the document is encrypted.
true
if the document is encrypted.public boolean isNew()
true
if the document is new, i.e. not yet written.
true
if the document is new, i.e. not yet
written.public boolean isReadOnly()
true
if the document is read only. To save the
document and its changes you have to define another ILocator
when
saving.
true
if the document is read only.public Iterator objects()
ATTENTION: This iterator may (and on incremental documents most often will) return objects that are no longer used (referenced) in the document.
public int referenceCount()
COSObject
lifecycle to ensure internal consistency.
referenceCount
in interface ICOSContainer
public COSIndirectObject referenceIndirect(COSObject object)
COSObject
lifecycle to ensure internal consistency.
referenceIndirect
in interface ICOSContainer
object
- The object to be indirectpublic void register(COSDocumentElement object)
COSObject
lifecycle to ensure internal consistency.
register
in interface ICOSContainer
object
- The new object to be registered in the hierarchy.public Object removeAttribute(Object key)
IAttributeSupport
removeAttribute
in interface IAttributeSupport
key
- the name of the attribute to remove
key
public void removeMonitor(ICOSMonitor monitor)
public void removeDocumentListener(ICOSDocumentListener listener)
ICOSDocumentListener
.
listener
- The listener to be removedpublic void restore(ILocator locator) throws IOException, COSLoadException
ILocator
must reference a data
stream that was previously used to parse the document.
locator
- The ILocator
defining the new physical content.
IOException
COSLoadException
public ICOSContainer restoreStateContainer(ICOSContainer container)
COSObject
lifecycle to ensure internal consistency.
restoreStateContainer
in interface ICOSContainer
public void save() throws IOException
ILocator
.
IOException
public void save(ILocator locator) throws IOException
ILocator
.
locator
- The ILocator
defining the new data location.
IOException
public void save(ILocator locator, Map options) throws IOException
ILocator
using the
options
to control specific serializing behavior such as
"incremental writing".
locator
- options
-
IOException
public ICOSContainer saveStateContainer()
COSObject
lifecycle to ensure internal consistency.
saveStateContainer
in interface ICOSContainer
public Object setAttribute(Object key, Object value)
IAttributeSupport
setAttribute
in interface IAttributeSupport
key
- the name of the attribute to setvalue
- the new value the attribute
key
public void setInfoDict(COSInfoDict infoDict)
infoDict
- The info dictionary containing metadata.public void setName(String name)
name
- The new name.public void setWriteModeHint(EnumWriteMode writeMode)
writeMode
- The write mode to be used when the document is written.public STDocument stGetDoc()
public void triggerChangedAll()
COSObject
lifecycle to ensure internal consistency.
public void willChange(COSObject change)
COSObject
lifecycle to ensure internal consistency.
willChange
in interface ICOSContainer
|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |