|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pdfbox.cos.COSBase
org.pdfbox.cos.COSDocument
This is the in-memory representation of the PDF document. You need to call close() on this object when you are done using it!!
Constructor Summary | |
COSDocument()
Constructor. |
|
COSDocument(File scratchDir)
Constructor that will create a create a scratch file in the following directory. |
|
COSDocument(RandomAccess file)
Constructor that will use the following random access file for storage of the PDF streams. |
Method Summary | |
Object |
accept(ICOSVisitor visitor)
visitor pattern double dispatch method. |
COSObject |
addObject(COSObject obj)
This will add an object to this document. |
void |
close()
This will close all storage and delete the tmp files. |
void |
dereferenceObjectStreams()
This method will search the list of objects for types of ObjStm. |
protected void |
finalize()
The sole purpose of this is to inform a client of PDFBox that they did not close the document. |
COSObject |
getCatalog()
This will get the document catalog. |
COSArray |
getDocumentID()
This will get the document ID. |
COSDictionary |
getEncryptionDictionary()
This will get the encryption dictionary if the document is encrypted or null if the document is not encrypted. |
String |
getHeaderString()
|
COSObject |
getObjectByType(COSName type)
This will get the first dictionary object by type. |
COSObject |
getObjectByType(String type)
This will get the first dictionary object by type. |
COSObject |
getObjectFromPool(COSObjectKey key)
This will get an object from the pool. |
List |
getObjects()
This will get a list of all available objects. |
List |
getObjectsByType(COSName type)
This will get a dictionary object by type. |
List |
getObjectsByType(String type)
This will get all dictionary objects by type. |
RandomAccess |
getScratchFile()
This will get the scratch file for this document. |
COSDictionary |
getTrailer()
This will get the document trailer. |
float |
getVersion()
This will get the version of this PDF document. |
boolean |
isEncrypted()
This will tell if this is an encrypted document. |
void |
print()
This will print contents to stdout. |
void |
setDocumentID(COSArray id)
This will set the document ID. |
void |
setEncryptionDictionary(COSDictionary encDictionary)
This will set the encryption dictionary, this should only be called when encypting the document. |
void |
setHeaderString(String header)
|
void |
setTrailer(COSDictionary newTrailer)
// MIT added, maybe this should not be supported as trailer is a persistence construct. |
void |
setVersion(float versionValue)
This will set the version of this PDF document. |
Methods inherited from class org.pdfbox.cos.COSBase |
getCOSObject, getFilterManager |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public COSDocument() throws IOException
IOException
- If there is an error creating the tmp file.public COSDocument(File scratchDir) throws IOException
scratchDir
- The directory to store a scratch file.
IOException
- If there is an error creating the tmp file.public COSDocument(RandomAccess file)
file
- The random access file to use for storage.Method Detail |
public RandomAccess getScratchFile()
public COSObject getObjectByType(String type)
type
- The type of the object.
public COSObject getObjectByType(COSName type)
type
- The type of the object.
public List getObjectsByType(String type)
type
- The type of the object.
public List getObjectsByType(COSName type)
type
- The type of the object.
public void print()
public void setVersion(float versionValue)
versionValue
- The version of the PDF document.public float getVersion()
public boolean isEncrypted()
public COSDictionary getEncryptionDictionary()
public void setEncryptionDictionary(COSDictionary encDictionary)
encDictionary
- The encryption dictionary.public COSArray getDocumentID()
public void setDocumentID(COSArray id)
id
- The document id.public COSObject getCatalog() throws IOException
IOException
- If no catalog can be found.public List getObjects()
public COSDictionary getTrailer()
public void setTrailer(COSDictionary newTrailer)
newTrailer
- the document trailer dictionarypublic Object accept(ICOSVisitor visitor) throws COSVisitorException
accept
in class COSBase
visitor
- The object to notify when visiting this object.
COSVisitorException
- If an error occurs while visiting this object.public void close() throws IOException
IOException
- If there is an error close resources.protected void finalize()
public String getHeaderString()
public void setHeaderString(String header)
header
- The headerString to set.public void dereferenceObjectStreams() throws IOException
IOException
- If there is an error parsing the stream.public COSObject addObject(COSObject obj) throws IOException
obj
- The object to add to the document.
IOException
- If there is an error adding the object.public COSObject getObjectFromPool(COSObjectKey key) throws IOException
key
- The object key.
IOException
- If there is an error getting the proxy object.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |