|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pdfbox.cos.COSBase
org.apache.pdfbox.cos.COSDocument
public class 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(java.io.File scratchDir)
Constructor that will create a create a scratch file in the following directory. |
|
COSDocument(java.io.File scratchDir,
boolean forceParsing)
Constructor that will use a temporary file in the given directory for storage of the PDF streams. |
|
COSDocument(RandomAccess file)
Constructor that will use the following random access file for storage of the PDF streams. |
|
COSDocument(RandomAccess scratchFile,
boolean forceParsing)
Constructor that will use the given random access file for storage of the PDF streams. |
|
| Method Summary | |
|---|---|
java.lang.Object |
accept(ICOSVisitor visitor)
visitor pattern double dispatch method. |
void |
addXRefTable(java.util.Map<COSObjectKey,java.lang.Integer> xrefTable)
Populate XRef HashMap with given values. |
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()
Warn the user in the finalizer if he didn't close the PDF 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. |
java.lang.String |
getHeaderString()
|
COSDictionary |
getLastSignatureDictionary()
|
COSObject |
getObjectByType(COSName type)
This will get the first dictionary object by type. |
COSObject |
getObjectByType(java.lang.String type)
This will get the first dictionary object by type. |
COSObject |
getObjectFromPool(COSObjectKey key)
This will get an object from the pool. |
java.util.List<COSObject> |
getObjects()
This will get a list of all available objects. |
java.util.List<COSObject> |
getObjectsByType(COSName type)
This will get a dictionary object by type. |
java.util.List<COSObject> |
getObjectsByType(java.lang.String type)
This will get all dictionary objects by type. |
RandomAccess |
getScratchFile()
This will get the scratch file for this document. |
SignatureInterface |
getSignatureInterface()
|
int |
getStartXref()
Return the startXref Position of the parsed document. |
COSDictionary |
getTrailer()
This will get the document trailer. |
float |
getVersion()
This will get the version of this PDF document. |
java.util.Map<COSObjectKey,java.lang.Integer> |
getXrefTable()
Returns the xrefTable which is a mapping of ObjectKeys to byte offsets in the file. |
boolean |
isEncrypted()
This will tell if this is an encrypted document. |
void |
print()
This will print contents to stdout. |
COSObject |
removeObject(COSObjectKey key)
Removes an object from the object pool. |
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 encrypting the document. |
void |
setHeaderString(java.lang.String header)
|
void |
setSignatureInterface(SignatureInterface signatureInterface)
|
void |
setStartXref(int startXref)
This method set the startxref value of the document. |
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. |
void |
setWarnMissingClose(boolean warn)
Controls whether this instance shall issue a warning if the PDF document wasn't closed properly through a call to the close() method. |
| Methods inherited from class org.apache.pdfbox.cos.COSBase |
|---|
getCOSObject, getFilterManager, isDirect, isNeedToBeUpdate, setDirect, setNeedToBeUpdate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public COSDocument(RandomAccess scratchFile,
boolean forceParsing)
scratchFile - the random access file to use for storageforceParsing - flag to skip malformed or otherwise unparseable
document content where possible
public COSDocument(java.io.File scratchDir,
boolean forceParsing)
throws java.io.IOException
scratchDir - directory for the temporary file,
or null to use the system defaultforceParsing - flag to skip malformed or otherwise unparseable
document content where possible
java.io.IOException
public COSDocument()
throws java.io.IOException
java.io.IOException - If there is an error creating the tmp file.
public COSDocument(java.io.File scratchDir)
throws java.io.IOException
scratchDir - The directory to store a scratch file.
java.io.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(java.lang.String type)
throws java.io.IOException
type - The type of the object.
java.io.IOException - If there is an error getting the object
public COSObject getObjectByType(COSName type)
throws java.io.IOException
type - The type of the object.
java.io.IOException - If there is an error getting the object
public java.util.List<COSObject> getObjectsByType(java.lang.String type)
throws java.io.IOException
type - The type of the object.
java.io.IOException - If there is an error getting the object
public java.util.List<COSObject> getObjectsByType(COSName type)
throws java.io.IOException
type - The type of the object.
java.io.IOException - If there is an error getting the objectpublic void print()
public void setVersion(float versionValue)
versionValue - The version of the PDF document.public float getVersion()
public boolean isEncrypted()
public COSDictionary getEncryptionDictionary()
public SignatureInterface getSignatureInterface()
public void setEncryptionDictionary(COSDictionary encDictionary)
encDictionary - The encryption dictionary.
public COSDictionary getLastSignatureDictionary()
throws java.io.IOException
java.io.IOExceptionpublic COSArray getDocumentID()
public void setDocumentID(COSArray id)
id - The document id.public void setSignatureInterface(SignatureInterface signatureInterface)
public COSObject getCatalog()
throws java.io.IOException
java.io.IOException - If no catalog can be found.public java.util.List<COSObject> getObjects()
public COSDictionary getTrailer()
public void setTrailer(COSDictionary newTrailer)
newTrailer - the document trailer dictionary
public java.lang.Object accept(ICOSVisitor visitor)
throws COSVisitorException
accept in class COSBasevisitor - The object to notify when visiting this object.
COSVisitorException - If an error occurs while visiting this object.
public void close()
throws java.io.IOException
java.io.IOException - If there is an error close resources.
protected void finalize()
throws java.io.IOException
finalize in class java.lang.Objectjava.io.IOException - if an error occurs while closing the temporary filespublic void setWarnMissingClose(boolean warn)
close() method. If the PDF document is held in
a cache governed by soft references it is impossible to reliably close the document
before the warning is raised. By default, the warning is enabled.
warn - true enables the warning, false disables it.public java.lang.String getHeaderString()
public void setHeaderString(java.lang.String header)
header - The headerString to set.
public void dereferenceObjectStreams()
throws java.io.IOException
java.io.IOException - If there is an error parsing the stream.
public COSObject getObjectFromPool(COSObjectKey key)
throws java.io.IOException
key - The object key.
java.io.IOException - If there is an error getting the proxy object.public COSObject removeObject(COSObjectKey key)
key - the object key
public void addXRefTable(java.util.Map<COSObjectKey,java.lang.Integer> xrefTable)
_xrefTable - xref table entries to be addedpublic java.util.Map<COSObjectKey,java.lang.Integer> getXrefTable()
public void setStartXref(int startXref)
readInt - public int getStartXref()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||