#define cosDocCreateInfoDict
0x01
#define cosSaveBinaryOK
0x08
#define cosSaveConcealObjStreams
0x10
#define cosSaveCopy
0x04
#define cosSaveFullSave
0x02
#define cosSaveGarbageCollect
0x01
#define kCosDocOpenDoRepair
0x0001
typedef
ASUns8
CosByte
;
typedef
struct
_t_CosDoc
*
CosDoc
;
typedef
ASFlagBits
CosDocSaveFlags
;
%%EOF
keyword that marks the end of either a main cross-reference section, or an update cross-reference section that corresponds to an incremental save. See CosDocEnumEOFs() for more details. Note: The precise value passed to the procedure is not defined. It is at least one byte past the %%EOF
keyword, but may include one or more white space characters. When the procedure is called only once, there is no guarantee that fileOffset
is the same as the length of the file.
ASBool
CosDocEnumEOFsProc(
CosDoc
cosDoc
,
ASFileOffset
fileOffset
,
void
*
clientData
);
cosDoc | The CosDoc in which the EOF is found.
|
fileOffset | The 31-bit offset into the file directly following the
%%EOF keyword. If the procedure is called more than once, the file positions passed to it are in decreasing order (that is, the EOF positions are treated as rollback points). |
clientData | User-supplied data that was passed in the call to CosDocEnumEOFs().
|
%%EOF
keyword that marks the end of either a main cross-reference section, or an update cross-reference section that corresponds to an incremental save. See CosDocEnumEOFs() for more details. This is similar to CosDocEnumEOFsProc(), except that the fileOffset
parameter is a 64-bit value instead of a 31-bit value. ASBool
CosDocEnumEOFsProc64(
CosDoc
cosDoc
,
ASFileOffset64
fileOffset
,
void
*
clientData
);
cosDoc | The CosDoc in which the EOF is found.
|
fileOffset | The 64-bit offset into the file directly following the
%%EOF keyword. |
clientData | User-supplied data that was passed in the call to CosDocEnumEOFs64().
|
| |
The size of this
struct . | |
A bitfield of kCosDocOpen flags.
| |
May be
NULL if using the default file system. | |
Must be provided.
| |
const char * headerString ; | |
|
| |
The size of this
struct . | |
const char * header ; | A complete header string, such as
"%ADF-1.0" . |
char * cryptData ; | The encryption key to pass into the PDCryptHandler if security has been set on the document.
|
The length of the encryption key in bytes. Cannot be greater than 5.
| |
The progress monitor. Use AVAppGetDocProgressMonitor() to obtain the default progress monitor.
| |
void * monClientData ; | A pointer to user-supplied data to pass to
mon each time it is called. |
The Cos cryptographic version- the version of the algorithm that is used to encrypt and decrypt document data.
cryptVersion equal to 0 is treated as cryptVersion equal to 1 , to maintain backward compatibility. | |
|
CosDocOpenWithParams
()
to release resources used by the Cos document. void
CosDocClose(
CosDoc
cosDoc
);
cosDoc | IN/OUT The document to close.
|
CosDoc
CosDocCreate(
ASFlagBits
createFlags
);
createFlags | An inclusive OR of bit flags that specify the attributes of a CosDoc when created by
CosDocCreate () . The only flag currently defined is cosDocCreateInfoDict (0x01) , which creates an Info dictionary for the document. |
Calls the specified procedure for each EOF in a given CosDoc
, where the EOF is a position in a PDF file after a %%EOF
keyword that marks the end of either a main cross-reference section, or an update cross-reference section that corresponds to an incremental save. Not every %%EOF
keyword fits these criteria. For example, the first %%EOF
in a linearized (optimized for the web) file does not, so its position is not be passed to proc
.
If cosDoc
was created in memory (using CosDocCreate()), or if it was damaged and needed to be repaired, the procedure is not called at all.
ASBool
CosDocEnumEOFs(
CosDoc
cosDoc
,
CosDocEnumEOFsProc
proc
,
void
*
clientData
);
cosDoc | The
CosDoc in which the EOF's are enumerated. |
proc | The
CosDocEnumEOFsProc () to call for each EOF. |
clientData | A pointer to user-supplied data to pass to
proc each time it is called. |
CosDoc
. For details, see CosDocEnumEOFs
()
. This is the same as CosDocEnumEOFs
()
, except that the callback proc takes a 64-bit file position instead of a 32-bit file position. ASBool
CosDocEnumEOFs64(
CosDoc
cosDoc
,
CosDocEnumEOFsProc64
proc
,
void
*
clientData
);
cosDoc | The
CosDoc in which the EOF's are enumerated. |
proc | The
CosDocEnumEOFsProc64 () to call for each EOF. |
clientData | A pointer to user-supplied data to pass to
proc each time it is called. |
Enumerates all the indirect objects of a given CosDoc
.
The objects are enumerated in no particular order. Successive enumerations of the same Cos document are not guaranteed to enumerate objects in the same order.
This method does not enumerate invalid objects, which include objects that are defined as NULL
, objects that are not defined at all (those having no cross-reference entry), and objects that are on the free list. See the description of "Indirect Objects" in section 7.3.10 in ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 7.11.2, page 21.
You can find this document on the web store of the International Standards Organization (ISO).
This re-raises any exception that proc
raises.
ASBool
CosDocEnumIndirect(
CosDoc
dP
,
CosObjEnumProc
proc
,
void
*
clientData
);
dP | The
CosDoc whose indirect objects are enumerated. |
proc | |
clientData | A pointer to user-supplied data to pass to
proc each time it is called. |
Tests whether the supplied CosDoc
contains the Adobe Extensions Dictionary for the ISO 32000 standard, and if so, returns the BaseVersion and ExtensionLevel
When the Extensions Dictionary is added to a PDF document, it allows PDF features provided in Adobe Acrobat after PDF version 1.7 to be used with that document. The version of the PDF file is drawn from the Extensions Dictionary instead of from the file header.
See https://www.adobe.com/devnet/pdf/pdf_reference.html
ASBool
CosDocGetAdobeExtensionLevel(
CosDoc
dP
,
CosObj
*
baseVersion
,
ASUns32
*
extension
);
dP | IN The Cos document to test.
|
baseVersion | |
extension | OUT The level of the extension expressed as a monotonically increasing integer.
|
true
if the file contains the Adobe Extensions dictionary for the ISO 32000 standard, false
otherwise.
When the Extensions Dictionary is added to a PDF document, it allows PDF features provided in Adobe Acrobat after PDF version 1.7 to be used with that document. The version of the PDF file is drawn from the Extensions Dictionary instead of from the file header. See https://www.adobe.com/devnet/pdf/pdf_reference.html
ASBool
CosDocGetID(
CosDoc
dP
,
CosByte
*
*
pInstanceID
,
CosByte
*
*
pPermaID
,
ASTCount
*
instIDLength
,
ASTCount
*
permIDLength
);
dP | IN/OUT The CosDoc whose ID byte arrays are returned.
|
pInstanceID | IN/OUT (Filled by the method) The instance ID.
|
pPermaID | IN/OUT (Filled by the method) The permanent ID.
|
instIDLength | IN/OUT The length of
pInstanceID in bytes. |
permIDLength | IN/OUT The length of
pPermaID in bytes. |
Info
dictionary. In general, access the document's Info
dictionary using PDDocGetInfo() and PDDocSetInfo
()
wherever possible. CosObj
CosDocGetInfoDict(
CosDoc
dP
);
dP | IN/OUT The document whose
Info dictionary is obtained. |
Info
dictionary Cos object. CosObj
with the latest generation number. CosObj
CosDocGetObjByID(
CosDoc
dP
,
CosID
objNum
);
dP | The
CosDoc to search for the matching Cos object. |
objNum | The local master index for the indirect Cos object to return.
|
Gets the Catalog
(the root object) for the specified document.
See the description of the Document Catalog in "Common Data Structures" in ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 7.7.2, page 71.
You can find this document on the web store of the International Standards Organization (ISO).
CosObj
CosDocGetRoot(
CosDoc
dP
);
dP | IN/OUT The document whose
Catalog is obtained. |
Catalog
dictionary Cos object.
Tests whether the Cos document is fully compressed. In a fully compressed document, most objects are stored in object streams, which are normally Flate-encoded to reduce the size of the PDF file. Cross-reference information for these objects is stored in cross-reference streams, which are also normally Flate-encoded.
See the description of "Cross-Reference Streams" in ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 7.5.8, page 49.
You can find this document on the web store of the International Standards Organization (ISO).
ASBool
CosDocHasFullCompression(
CosDoc
doc
);
doc | The document whose compression is checked.
|
Tests whether the supplied CosDoc
contains the Adobe Extensions Dictionary for the ISO 32000 standard.
When the Extensions Dictionary is added to a PDF document, it allows PDF features provided in Adobe Acrobat after PDF version 1.7 to be used with that document. The version of the PDF file is drawn from the Extensions Dictionary instead of from the file header.
See https://www.adobe.com/devnet/pdf/pdf_reference.html
ASBool
CosDocHasISOExtensions(
CosDoc
dP
);
dP | The Cos document to test.
|
true
if the file contains the Adobe Extensions dictionary for the ISO 32000 standard, false
otherwise.
When the Extensions Dictionary is added to a PDF document, it allows PDF features provided in Adobe Acrobat after PDF version 1.7 to be used with that document. The version of the PDF file is drawn from the Extensions Dictionary instead of from the file header. See https://www.adobe.com/devnet/pdf/pdf_reference.html
Tests whether the Cos document is partially compressed. In a partially compressed file, the size of the logical structure information is reduced. Current PDF viewers have full access to the structure information.
In a partially compressed document, objects related to logical structure are stored in object streams, which are normally Flate-encoded to compress the document. Their cross-reference information is stored twice: in a cross-reference stream, to which there is a reference in the trailer of an update section, and in the main cross-reference table, which indicates that the objects are on the free list.
See the description of "Cross-Reference Streams" in section 7.5.8 in ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, page 49.
You can find this document on the web store of the International Standards Organization (ISO).
See also the decription of the "Cross-Reference Table" in section 7.5.3, page 40.
ASBool
CosDocHasPartialCompression(
CosDoc
doc
);
doc | The document whose compression is checked.
|
Tests whether the definition of a specified Cos object, in the file associated with the object's CosDoc, begins within any of a set of byte ranges. The test is inclusive; that is the object may begin at the first or last byte of a range.
An exception is raised if obj
is a direct object or numEntries
is an odd number.
ASBool
CosDocObjIsWithinRange(
CosObj
obj
,
ASInt32
byteRanges
[
]
,
ASInt32
numEntries
);
obj | The Cos object (must be indirect).
|
byteRanges | An array containing pairs of byte offsets within the document. Each pair is a start and end offset from the beginning of the document.
|
numEntries | The number of byte offsets (not pairs) in the
byteRanges array. |
Tests whether the definition of a specified Cos object, in the file associated with the object's CosDoc
, begins within any of a set of byte ranges. For details, see CosDocObjIsWithinRange
()
. This is the same as CosDocObjIsWithinRange
()
, except that the byte ranges are 64-bit file positions instead of a 32-bit file positions.
An exception is raised if obj
is a direct object or numEntries
is an odd number.
ASBool
CosDocObjIsWithinRange64(
CosObj
obj
,
ASFilePos64
byteRanges
[
]
,
ASInt32
numEntries
);
obj | The Cos object (must be indirect).
|
byteRanges | An array containing pairs of byte offsets within the document. Each pair is a start and end offset from the beginning of the document.
|
numEntries | The number of byte offsets (not pairs) in the
byteRanges array. |
Opens a Cos document. The document does not need to be a PDF document. In params
, the client specifies a file system and path name from which to open the document. The client may also specify a header string other than "%PDF-"
. For example, a client might want to open a private file type, such as "%FDF-"
.
Various exceptions may be raised. Opening non-Cos docs with this API is unsupported and may lock the file after an open attempt.
If the doRepair
flag is set in the open flags, a minimal document can be opened. A minimal document contains the header string and a trailer dictionary. It may contain indirect objects before the trailer dictionary, and the trailer dictionary can refer to those objects, as shown in the following example:
%FDF-1.0
1
0
obj
<
<
/Version
/1.5
/FDF
<
<
/F
20
0
R
/JavaScript
5
0
R
>
>
>
>
trailer
<
<
/Root
1
0
R
>
>
CosDoc
CosDocOpenWithParams(
CosDocOpenParams
params
);
params | Specifies how to open the document.
|
CosDocSaveToFile
()
will not generate a cross-reference index (table or stream) in the saved file. If you want the index to be generated, then you must use CosDocSaveWithParams
()
, which generates it by default. void
CosDocSaveToFile(
CosDoc
cosDoc
,
ASFile
asFile
,
CosDocSaveFlags
saveFlags
,
CosDocSaveParams
saveParams
);
cosDoc | The document to save.
|
asFile | The file to which the document is written; it must be open in write mode. This file is not necessarily position-able.
|
saveFlags | An
OR of the CosDocSaveFlags bit flag values specifying how to save the document. |
saveParams | Optional parameters for use when saving a document, as described in
CosDocSaveParams () . |
void
CosDocSaveWithParams(
CosDoc
cosDoc
,
ASFile
asFile
,
CosDocSaveFlags
saveFlags
,
CosDocSaveParams
saveParams
);
cosDoc | The
CosDoc for the document to save. |
asFile | The file to which the document will be written. This file must already be open in write mode. If you pass
NULL , cosDoc is saved to the file with which it was originally associated. |
saveFlags | An
OR of the CosDocSaveFlags bit flag values specifying how to save the document. |
saveParams | CosDocSaveParams parameters for use when saving the CosDoc document. |
Adds the necessary data structures to the supplied CosDoc
to identify it as containing the Adobe Extensions Dictionary for the ISO 32000 standard.
When the Extensions Dictionary is added to a PDF document, it allows PDF features provided in Adobe Acrobat after PDF version 1.7 to be used with that document. The version of the PDF file is drawn from the Extensions Dictionary instead of from the file header.
See https://www.adobe.com/devnet/pdf/pdf_reference.html
void
CosDocSetAdobeExtensionLevel(
CosDoc
dP
,
CosObj
baseVersion
,
ASUns32
extension
);
dP | The Cos document to set.
|
baseVersion | The PDF version on which the extensions are based (will be of type
CosName ). |
extension | The level of the extension expressed as a monotonically increasing integer.
|
void
CosDocSetDirty(
CosDoc
cosDoc
,
ASBool
isDirty
);
cosDoc | The Cos document whose
dirty flag is set. |
isDirty |
void
CosSetMaxDocStorage(
ASInt32
maxMemory
);
maxMemory | The maximum amount of RAM (in bytes) that will be used to store fixed-size Cos objects.
|