This is the in-memory representation of the PDF document. You need to call
close() on this object when you are done using it!!
accept
public Object accept(ICOSVisitor visitor)
throws COSVisitorException
visitor pattern double dispatch method.
- accept in interface COSBase
visitor
- The object to notify when visiting this object.
- any object, depending on the visitor implementation, or null
addObject
public COSObject addObject(COSObject obj)
throws IOException
This will add an object to this document.
the method checks if obj is already present as there may be cyclic dependencies
obj
- The object to add to the document.
- The object that was actually added to this document, if an object reference already
existed then that will be returned.
close
public void close()
throws IOException
This will close all storage and delete the tmp files.
dereferenceObjectStreams
public void dereferenceObjectStreams()
throws IOException
This method will search the list of objects for types of ObjStm. If it finds
them then it will parse out all of the objects from the stream that is contains.
finalize
protected void finalize()
The sole purpose of this is to inform a client of PDFBox that they
did not close the document.
getCatalog
public COSObject getCatalog()
throws IOException
This will get the document catalog.
Maybe this should move to an object at PDFEdit level
- catalog is the root of all document activities
getDocumentID
public COSArray getDocumentID()
This will get the document ID.
getEncryptionDictionary
public COSDictionary getEncryptionDictionary()
This will get the encryption dictionary if the document is encrypted or null
if the document is not encrypted.
- The encryption dictionary.
getHeaderString
public String getHeaderString()
- Returns the headerString.
getObjectByType
public COSObject getObjectByType(String type)
This will get the first dictionary object by type.
type
- The type of the object.
- This will return an object with the specified type.
getObjectByType
public COSObject getObjectByType(COSName type)
This will get the first dictionary object by type.
type
- The type of the object.
- This will return an object with the specified type.
getObjectFromPool
public COSObject getObjectFromPool(COSObjectKey key)
throws IOException
This will get an object from the pool.
- The object in the pool or a new one if it has not been parsed yet.
getObjects
public List getObjects()
This will get a list of all available objects.
getObjectsByType
public List getObjectsByType(String type)
This will get all dictionary objects by type.
type
- The type of the object.
- This will return an object with the specified type.
getObjectsByType
public List getObjectsByType(COSName type)
This will get a dictionary object by type.
type
- The type of the object.
- This will return an object with the specified type.
getScratchFile
public RandomAccess getScratchFile()
This will get the scratch file for this document.
getTrailer
public COSDictionary getTrailer()
This will get the document trailer.
- the document trailer dict
getVersion
public float getVersion()
This will get the version of this PDF document.
isEncrypted
public boolean isEncrypted()
This will tell if this is an encrypted document.
- true If this document is encrypted.
print
public void print()
This will print contents to stdout.
setDocumentID
public void setDocumentID(COSArray id)
This will set the document ID.
setEncryptionDictionary
public void setEncryptionDictionary(COSDictionary encDictionary)
This will set the encryption dictionary, this should only be called when
encypting the document.
encDictionary
- The encryption dictionary.
setHeaderString
public void setHeaderString(String header)
header
- The headerString to set.
setTrailer
public void setTrailer(COSDictionary newTrailer)
// MIT added, maybe this should not be supported as trailer is a persistence construct.
This will set the document trailer.
newTrailer
- the document trailer dictionary
setVersion
public void setVersion(float versionValue)
This will set the version of this PDF document.
versionValue
- The version of the PDF document.