public final class CosDocument extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the
CosDocument and free any resources associated
with it. |
CosArray |
createCosArray()
Creates a new, empty COS array object.
|
CosArray |
createCosArray(ArrayList array)
Creates a new COS array object and populates it with the specified ArrayList
of CosObjects.
|
CosArray |
createCosArray(ArrayList array,
int directStatus)
Creates a new COS array object and populates it with the specified ArrayList
of CosObjects.
|
CosArray |
createCosArray(int directStatus)
Creates a new, empty COS array object.
|
CosArray |
createCosArrayFromNonCosData(ArrayList array)
Creates a new COS array object and populates it with the specified ArrayList
of non CosObjects.
|
CosArray |
createCosArrayFromNonCosData(ArrayList array,
int directStatus)
Creates a new COS array object and populates it with the specified ArrayList
of non CosObjects.
|
CosBoolean |
createCosBoolean(boolean value)
Create a new CosBoolean instance (always a direct object)
|
CosBoolean |
createCosBoolean(Boolean value)
Create a new CosBoolean instance (always a direct object)
|
CosDictionary |
createCosDictionary()
Creates an empty COS dictionary.
|
CosDictionary |
createCosDictionary(int directStatus)
Creates an empty COS dictionary.
|
CosDictionary |
createCosDictionary(Map cosData)
Creates a COS dictionary from a Map of Cos objects.
|
CosDictionary |
createCosDictionary(Map cosData,
int directStatus)
Creates a COS dictionary from a Map of Cos objects based on the value of
the directStatus enum.
|
CosDictionary |
createCosDictionaryFromNonCosData(Map javaMap)
Creates a COS dictionary from non CosObject data.
|
CosDictionary |
createCosDictionaryFromNonCosData(Map data,
int directStatus)
Constructs COS dictionary from the HashMap that contains non-Cos object values.
|
CosName |
createCosName(ASName value)
Creates a COS name object corresponding to the specified atom.
|
CosNull |
createCosNull()
Creates a COS null object.
|
CosNumeric |
createCosNumeric(byte[] inputRep)
Creates a COS numeric value object.
|
CosNumeric |
createCosNumeric(CosNumeric source)
Creates a COS numeric value object.
|
CosNumeric |
createCosNumeric(double value)
Creates a COS numeric value object.
|
CosNumeric |
createCosNumeric(int value)
Creates a COS numeric value object.
|
CosNumeric |
createCosNumeric(long value)
Creates a COS numeric value object.
|
CosNumeric |
createCosNumeric(Number value)
Creates a COS numeric value object.
|
CosObjectStream |
createCosObjectStream()
Create a new, initialized CosObjectStream instance
|
CosStream |
createCosStream()
Creates a COS stream with an empty stream data.
|
CosStream |
createCosStream(InputByteStream data)
Creates a CosStream object.
|
CosString |
createCosString(ASString value)
Creates a COS string object.
|
CosString |
createCosString(byte[] value)
Creates a COS string object.
|
CosString |
createCosString(String value)
Creates a COS string object.
|
CosDictionary |
createDirectCosDictionary()
Creates an empty COS dictionary.
|
CosDictionary |
createDirectCosDictionary(Map cosData)
Creates a COS dictionary from a Map of Cos objects.
|
CosDictionary |
createDirectCosDictionaryFromNonCosData(Map javaMap)
Creates a COS dictionary from non CosObject data.
|
CosString |
createHexCosString(ASString value)
Creates a COS hex string object.
|
CosString |
createHexCosString(byte[] value)
Creates a COS hex string object.
|
CosString |
createHexCosString(String value)
Creates a COS hex string object.
|
CosArray |
createIndirectCosArray()
Creates a new, empty COS array object.
|
CosArray |
createIndirectCosArray(ArrayList array)
Creates a new COS array object and populates it with the specified ArrayList
of CosObjects.
|
CosArray |
createIndirectCosArrayFromNonCosData(ArrayList array)
Creates a new COS array object and populates it with the specified ArrayList
of non CosObjects.
|
PDFCore |
finish() |
void |
freeDuplicateResources()
Parse the document to identify and remove duplicate resources
referenced in the page resource object trees.
|
boolean |
freeUnreferencedObjects()
Explicit early cleanup of unreferenced objects as done in full save.
|
ByteReader |
getByteReader() |
CosList |
getChangedObjects(long eof)
Return CosLIst of objects added, deleted, or changed since EOF value.
|
CosEncryption |
getEncryption() |
long |
getEOF() |
Object |
getFdfDocument()
Returns pointer to FDFDocument
|
long |
getFileSize() |
int |
getHeaderTrashCount()
Return the count of trash bytes that appear before the document header.
|
CosObject |
getIndirectObjectByNumber(int objNum)
Return an indirect CosObject instance corresponding to an object number.
|
CosObjectInfo |
getIndirectObjectInfoByNumber(int objNum)
Return an indirect CosObjectInfo instance corresponding to an object number.
|
CosDictionary |
getInfo()
Retrieves the Information CosDictionary of the document, may be null.
|
ByteWriter |
getInPlaceByteWriter() |
static String |
getLoggingPath() |
int |
getNumObjects() |
int |
getNumRevisions()
Get total number of revisions for this document.
|
long |
getObjEOF(CosObject obj)
Return EOF of object's update section or zero if cannot be determined.
|
int |
getObjRevision(CosObject obj)
Return index of object's update section or -1 if cannot be determined.
|
CosOpenOptions |
getOptions() |
String |
getOriginalVersion()
Returns the version string of the PDF file (e.g.
|
Object |
getPdfDocument()
Gets pointer to PDFDocument
|
EnumSet<REPAIRTYPE> |
getRepairTypes() |
CosDictionary |
getRoot()
Retrieves the root CosDictionary of the document if it's not already
cached; otherwise, returns the cached root.
|
InputByteStream |
getStream()
Obtain a slice of the underlying InputByteStream for the document.
|
InputByteStream |
getStream(long start,
long length)
Obtain a slice of the underlying InputByteStream for the document.
|
StreamManager |
getStreamManager()
Get the
StreamManager to use for this document. |
Map |
getToSaveExtensions() |
String |
getToSaveVersion() |
CosDictionary |
getTrailer()
Retrieves the trailer from the document.
|
CosDictionary[] |
getTrailerList() |
int |
getTrailerTrashCount()
Return the count of trash bytes that appear after the document trailer.
|
CosObject[] |
getUnreferencedObjects()
Return an array of unreferenced indirect objects in this document.
|
int |
getXRefType()
Get the current XRef type
|
boolean |
isCacheEnabled() |
boolean |
isDirty()
Is the document dirty?
|
boolean |
isEncrypted() |
boolean |
isLinearized()
Returns true iff the document is currently linearized.
|
boolean |
isToSaveExtensionsInitialized() |
void |
markDirty() |
boolean |
markNotDirty()
Mark document as not dirty.
|
static CosDocument |
newDocument(ByteReader byteReader,
CosOpenOptions options)
Returns an empty document with some initialized data structures so that
you can build a new CosDocument.
|
static CosDocument |
newDocument(CosOpenOptions options)
Returns an empty document with some initialized data structures so that
you can build a new CosDocument.
|
static CosDocument |
newDocument(PDFCore pdfCore)
Once a CosDocument was instanciated from a PDFCore object, that PDFCore object
can't be used again.
|
String |
procureOriginalVersion() |
String |
procureToSaveVersion() |
void |
save(ByteWriter byteWriter,
CosSaveParams params)
Perform an save with previously specified save style
|
void |
setFDFDocument(Object fdfDocument)
Sets pointer to FDFDocument
|
static void |
setLoggingPath(String loggingPath) |
void |
setNextIncrementalSectionOffset(long nextIncrementalSectionOffset)
Sets the offset where next incremental section shall be written if
the document is saved incrementally.
|
void |
setPDFDocument(Object pdfdocument)
Sets pointer to PDFDocument
|
void |
setToSaveExtensions(Map extensions) |
void |
setToSaveVersion(String version) |
void |
setUseRepairList(boolean useRepairList)
For some API's such as PDF/A validation Gibson needs to work on original
cos objects and ignore repairs made to cos objects.
|
boolean |
wasLinearized()
Returns true iff the BASE document was a linearized document,
but later suffered incremental updates that spoil its perfect order.
|
boolean |
wasRepaired() |
public static CosDocument newDocument(ByteReader byteReader, CosOpenOptions options) throws PDFCosParseException, PDFIOException, PDFSecurityException
byteReader - the PDF data for the documentoptions - the options to provide for the new documentPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic static CosDocument newDocument(CosOpenOptions options) throws PDFCosParseException, PDFIOException, PDFSecurityException
options - the options to provide for the new documentPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic static CosDocument newDocument(PDFCore pdfCore) throws PDFCosParseException, PDFIOException, PDFSecurityException
pdfCore - PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic StreamManager getStreamManager()
StreamManager to use for this document.public PDFCore finish()
public void close()
throws PDFIOException,
PDFCosParseException,
PDFSecurityException
CosDocument and free any resources associated
with it.public String getOriginalVersion() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic String procureOriginalVersion() throws PDFCosParseException, PDFIOException, PDFSecurityException
public Map getToSaveExtensions()
public void setToSaveExtensions(Map extensions)
public boolean isToSaveExtensionsInitialized()
public String getToSaveVersion()
public void setToSaveVersion(String version)
public String procureToSaveVersion() throws PDFCosParseException, PDFIOException, PDFSecurityException
public CosDictionary getTrailer()
public CosDictionary[] getTrailerList()
public CosDictionary getRoot() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary getInfo() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic InputByteStream getStream(long start, long length) throws PDFIOException
start - the offset in the CosDocument's InputByteStream
to use as the start of the returned slicelength - the length of the slice to createPDFIOExceptionpublic InputByteStream getStream() throws PDFIOException
PDFIOExceptionpublic int getNumObjects()
public CosOpenOptions getOptions()
public boolean isLinearized()
public boolean wasLinearized()
public boolean wasRepaired()
public EnumSet<REPAIRTYPE> getRepairTypes()
public void setFDFDocument(Object fdfDocument)
fdfDocument - FDFDocument to setpublic Object getFdfDocument()
public void setPDFDocument(Object pdfdocument)
pdfdocument - PDFDocument to setpublic Object getPdfDocument()
public void freeDuplicateResources()
throws PDFCosParseException,
PDFIOException,
PDFSecurityException
Note: This method must be explicitly invoked by the client prior to save. It should only be invoked before full save and linear save.
public boolean freeUnreferencedObjects()
throws PDFCosParseException,
PDFIOException,
PDFSecurityException
public CosObject[] getUnreferencedObjects() throws PDFCosParseException, PDFIOException, PDFSecurityException
public void save(ByteWriter byteWriter, CosSaveParams params) throws PDFCosParseException, PDFInvalidParameterException, PDFIOException, PDFSecurityException
byteWriter - for writing the PDF document toparams - indicating save stylePDFCosParseExceptionPDFInvalidParameterExceptionPDFIOExceptionPDFSecurityExceptionpublic static void setLoggingPath(String loggingPath)
public static String getLoggingPath()
public ByteWriter getInPlaceByteWriter()
public ByteReader getByteReader()
ByteReaderpublic void setNextIncrementalSectionOffset(long nextIncrementalSectionOffset)
nextIncrementalSectionOffset - public boolean isCacheEnabled()
public boolean isEncrypted()
public CosEncryption getEncryption()
public CosObject getIndirectObjectByNumber(int objNum) throws PDFCosParseException, PDFIOException, PDFSecurityException
objNum - Indirect object number of COS object whose byte location is desiredPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosObjectInfo getIndirectObjectInfoByNumber(int objNum) throws PDFCosParseException, PDFIOException, PDFSecurityException
public long getObjEOF(CosObject obj)
public int getObjRevision(CosObject obj)
public int getHeaderTrashCount()
public int getTrailerTrashCount()
public int getNumRevisions()
public long getFileSize()
throws PDFIOException
PDFIOExceptionpublic CosList getChangedObjects(long eof) throws PDFCosParseException, PDFIOException, PDFSecurityException
public void markDirty()
public boolean isDirty()
true if the document is dirty; false otherwisepublic boolean markNotDirty()
public long getEOF()
throws PDFIOException
PDFIOExceptionpublic int getXRefType()
public CosArray createCosArray(ArrayList array, int directStatus) throws PDFCosParseException, PDFIOException, PDFSecurityException
array - - ArrayList of CosObjects that becomes the data in the new CosArray objectPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createIndirectCosArray(ArrayList array) throws PDFCosParseException, PDFIOException, PDFSecurityException
array - - ArrayList of CosObjects that becomes the data in the new CosArray objectPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createCosArray(ArrayList array) throws PDFCosParseException, PDFIOException, PDFSecurityException
array - - ArrayList of CosObjects that becomes the data in the new CosArray objectPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createCosArrayFromNonCosData(ArrayList array, int directStatus) throws PDFCosParseException, PDFIOException, PDFSecurityException
array - - ArrayList of non CosObjects that becomes the data in the new CosArray objectPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createIndirectCosArrayFromNonCosData(ArrayList array) throws PDFCosParseException, PDFIOException, PDFSecurityException
array - - ArrayList of non CosObjects that becomes the data in the new CosArray objectPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createCosArrayFromNonCosData(ArrayList array) throws PDFCosParseException, PDFIOException, PDFSecurityException
array - - ArrayList of non CosObjects that becomes the data in the new CosArray objectPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createCosArray(int directStatus) throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createIndirectCosArray() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosArray createCosArray() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosBoolean createCosBoolean(boolean value)
value - - boolean value attribute of the instancepublic CosBoolean createCosBoolean(Boolean value)
value - - Boolean value attribute of the instancepublic CosDictionary createCosDictionary(int directStatus) throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createCosDictionary() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createDirectCosDictionary() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createCosDictionary(Map cosData, int directStatus) throws PDFCosParseException, PDFIOException, PDFSecurityException
cosData - Map of Cos objects with ASName keysPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createCosDictionary(Map cosData) throws PDFCosParseException, PDFIOException, PDFSecurityException
cosData - Map of Cos objects with ASName keysPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createDirectCosDictionary(Map cosData) throws PDFCosParseException, PDFIOException, PDFSecurityException
cosData - Map of Cos objects with ASName keysPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createCosDictionaryFromNonCosData(Map data, int directStatus) throws PDFCosParseException, PDFIOException, PDFSecurityException
data - - a Map with string key - non-CosObject value pairsPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createCosDictionaryFromNonCosData(Map javaMap) throws PDFCosParseException, PDFIOException, PDFSecurityException
javaMap - - Map with strings as keys, nonCos objects as dataPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosDictionary createDirectCosDictionaryFromNonCosData(Map javaMap) throws PDFCosParseException, PDFIOException, PDFSecurityException
javaMap - - Map with strings as keys, nonCos objects as dataPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosName createCosName(ASName value)
value - Atom to be wrapped by a COS name objectpublic CosNull createCosNull()
public CosNumeric createCosNumeric(Number value)
value - Integer value for the objectpublic CosNumeric createCosNumeric(int value)
value - Integer value for the objectpublic CosNumeric createCosNumeric(long value)
value - Integer value for the objectpublic CosNumeric createCosNumeric(double value)
value - Floating point value for the objectpublic CosNumeric createCosNumeric(byte[] inputRep) throws PDFCosParseException
inputRep - byte string value for the objectPDFCosParseExceptionpublic CosNumeric createCosNumeric(CosNumeric source) throws PDFCosParseException, PDFIOException, PDFSecurityException
source - CosNumeric object to copyPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosObjectStream createCosObjectStream() throws PDFCosParseException, PDFIOException, PDFSecurityException
public CosStream createCosStream() throws PDFCosParseException, PDFIOException, PDFSecurityException
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosStream createCosStream(InputByteStream data) throws PDFCosParseException, PDFIOException, PDFSecurityException
data - Data for the stringPDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionpublic CosString createCosString(ASString value)
value - Data for the stringpublic CosString createCosString(byte[] value)
value - Data for the stringpublic CosString createCosString(String value)
value - String. NOTE this String must be in PDFDocEncoding.public CosString createHexCosString(ASString value)
value - Data for the stringpublic CosString createHexCosString(byte[] value)
value - Data for the stringpublic CosString createHexCosString(String value)
value - Data for the stringpublic void setUseRepairList(boolean useRepairList)
useRepairList - Copyright © 2010 - 2020 Adobe. All Rights Reserved