PDFileAttachment represents an embedded file stored in a PDF file, and may be stored at various locations in a PDF file, including the EmbeddedFiles name tree, FileAttachment annotation types, and Multimedia annotations. typedef OPAQUE_64_BITS PDFileAttachment;
PDFileAttachment object. An exception is raised if the parameter is not a file specification dictionary. PDFileAttachment PDFileAttachmentFromCosObj(CosObj cosAttachment);
attachment | The
CosObj to convert. |
CosObj representing the file specification dictionary of the file attachment. CosObj PDFileAttachmentGetCosObj(PDFileAttachment attachment);
attachment | The file attachment object.
|
CosObj representation of the file attachment. ASBool PDFileAttachmentGetCreationDate(PDFileAttachment attachment, ASTimeRec *date);
attachment | The file attachment object.
|
date | A pointer to a date that will receive the creation date.
|
ASBool PDFileAttachmentGetFieldDate(PDFileAttachment attachment, ASAtom fieldID, ASTimeRec *date);
attachment | The file attachment.
|
fieldID | The field identifier.
|
date | The date that will receive the field value.
|
ASBool PDFileAttachmentGetFieldNumber(PDFileAttachment attachment, ASAtom fieldID, float *number);
attachment | The file attachment.
|
fieldID | The field identifier.
|
number | The number that will receive the field value.
|
ASBool PDFileAttachmentGetFieldPrefix(PDFileAttachment attachment, ASAtom fieldName, ASText prefix);
attachment | The file attachment.
|
fieldID | The field identifier.
|
prefix | The text object that will receive the prefix.
|
ASBool PDFileAttachmentGetFieldStyle(PDFileAttachment attachment, ASAtom fieldID, ASCab styles);
attachment | The file attachment.
|
fieldID | The field identifier.
|
styles | ASCab object that will receive the field styles
|
ASBool PDFileAttachmentGetFieldStyledText(PDFileAttachment attachment, ASAtom fieldID, ASText text);
attachment | The file attachment.
|
fieldID | The field identifier.
|
text | The text object that will receive the field value.
|
ASBool PDFileAttachmentGetFieldText(PDFileAttachment attachment, ASAtom fieldID, ASText text);
attachment | The file attachment.
|
fieldID | The field identifier.
|
text | The text object that will receive the field value.
|
ASText PDFileAttachmentGetFileName(PDFileAttachment attachment);
attachment | The file attachment.
|
ASText copy of the file name of the file attachment. ASUns32 PDFileAttachmentGetFileSize(PDFileAttachment attachment);
attachment | The file attachment object
|
0 if the PDFileAttachment object does not specify a file size and one cannot be determined. ASBool PDFileAttachmentGetModDate(PDFileAttachment attachment, ASTimeRec *date);
attachment | The file attachment object.
|
date | A pointer to a date that will receive the modification date.
|
ASBool PDFileAttachmentIsValid(PDFileAttachment attachment);
attachment | The file attachment.
|
Creates a new file attachment from the given file. The resulting file specification dictionary is created for the given document, but is not referenced. The client must reference the resulting file specification dictionary by attaching it to another object in the PDF file, such as an annotation or name tree. An exception is raised if the file could not be read or the attachment stream could not be created.
Note that permissions must be checked by the caller before invoking this function.
For example, to have an attachment flate compressed and then ASCII base-85 encoded:
ASAtom filterNames[2]; filterNames[0] = ASAtomFromString("ASCII85Decode"); filterNames[1] = ASAtomFromString("FlateDecode"); PDFileAttachmentNewFromFile(parentDoc, sourceFile, filterNames, 2, CosNewNull(), NULL, NULL, NULL);
PDFileAttachment PDFileAttachmentNewFromFile(CosDoc parentDoc, ASFile sourceFile, const ASAtom *filterNames, const ASArraySize numFilters, CosObj filterParams, ASProgressMonitor monitor, ASConstText monitorText, void *monitorData);
parentDoc | The
CosDoc in which the file attachment dictionary will be created. |
sourceFile | The
ASFile from which to create the file attachment. |
filterNames | An array of filters to apply to the file attachment stream. Filters are indentified by name. See the description of Filters in the ISO 32000-1:2008, Document Management-Portable Document Format-Part 1: PDF 1.7, section 7.4, page 22. You can find this document on the web store of the International Standards Organization (ISO). |
numFilters | The number of elements in
filterNames. |
filterParams | The filter parameters, represented as a
CosArray or CosNull. When the array form is used, the array must contain the same number of elements as filterNames. Each element in the CosArray is a CosDict representing the filter parameters for the corresponding filter in the filterNames array, or CosNull to indicate that default parameters should be used for that filter. When the CosNull form is used for filterParams, default parameters are used for every filter in the filterNames array. |
monitor | The
ASProgressMonitor to use for the duration of the call. The monitor object is owned by the caller. NULL indicates that no progress updates are needed. |
monitorText | The text for the monitor to display, or
NULL if no text is needed. The text object is owned by the caller. |
monitorData | Opaque data that is specific to the monitor object.
|
ASStm PDFileAttachmentOpenStream(PDFileAttachment attachment);
attachment | The file attachment object.
|
void PDFileAttachmentSaveToFile(PDFileAttachment attachment, ASFile destFile);
attachment | The file attachment.
|
destFile | The file that will be written with the file attachment data.
|
void PDFileAttachmentSetFieldDate(PDFileAttachment attachment, ASAtom fieldID, const ASTimeRec *date);
attachment | The file attachment.
|
fieldID | The field identifier.
|
date | The date to use as the new value for the specified field.
|
is raised if the field does not exist in the collection schema or the field type is not
D (date). |
void PDFileAttachmentSetFieldNumber(PDFileAttachment attachment, ASAtom fieldID, float number);
attachment | The file attachment.
|
fieldID | The field identifier.
|
number | The number to use as the new value for the specified field.
|
is raised if the field does not exist in the collection schema or the field type is not
N (number). |
void PDFileAttachmentSetFieldPrefix(PDFileAttachment attachment, ASAtom fieldName, ASText text);
attachment | The file attachment.
|
fieldName | The field identifier.
|
text | The prefix to use as the new value for the specified field. Note that if a
NULL value is passed into this parameter, the prefix is removed and an exception will not be thrown. |
is raised if the field does not exist in the collection schema.
|
void PDFileAttachmentSetFieldStyle(PDFileAttachment attachment, ASAtom fieldID, ASConstCab styles);
attachment | The file attachment.
|
fieldID | The field identifier.
|
styles | ASConstCab containing field styles for the specified field.
|
is raised if the field does not exist in the collection schema or the field type is not
S (text). |
void PDFileAttachmentSetFieldStyledText(PDFileAttachment attachment, ASAtom fieldID, ASConstText text);
attachment | The file attachment.
|
fieldID | The field identifier.
|
text | Text Layout Format XML containing the text to use as the new value for the specified field.
|
is raised if the field does not exist in the collection schema or the field type is not
S (text). |
void PDFileAttachmentSetFieldText(PDFileAttachment attachment, ASAtom fieldID, ASText text);
attachment | The file attachment.
|
fieldID | The field identifier.
|
text | The text to use as the new value for the specified field.
|
is raised if the field does not exist in the collection schema or the field type is not
S (text). |
Updates a file attachment from the given file. The attachment uses the filters specified in the attachment to encode the data. An exception is raised if the file could not be read or the attachment stream could not be updated.
Note that permissions must be checked by the caller before invoking this function.
void PDFileAttachmentUpdateFromFile(PDFileAttachment attachment, ASFile sourceFile, ASProgressMonitor monitor, ASConstText monitorText, void *monitorData);
attachment | The file attachment.
|
sourceFile | The file to use as input for the update operation.
|
monitor | The
ASProgressMonitor to use for the duration of the call. The monitor object is owned by the caller. NULL indicates that no progress updates are needed. |
monitorText | The text for the monitor to display, or
NULL if no text is needed. The text object is owned by the caller. |
monitorData | Opaque data that is specific to the monitor object.
|