Pdf Component - PdfAttachment
18 Nov 20263 minutes to read
Represents a document-level attachment embedded in a PDF document.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first attachment
let attachment: PdfAttachment = document.attachments.getItem(0);
// Retrieve decoded attachment bytes
let bytes: Uint8Array = attachment.data;
// Get the attachment's zero-based index
let index: number = attachment.index;
// Destroy the document
document.destroy();Properties
Get creationDate Date
Gets the creation date of the attachment.
Set creationDate void
Sets the creation date of the attachment.
| Parameter | Type | Description |
|---|---|---|
| value | Date |
The creation date. |
Get data Uint8Array
Gets a defensive copy of the fully decoded attachment data.
Get description string
Gets the description of the attachment.
Set description void
Sets the description of the attachment.
| Parameter | Type | Description |
|---|---|---|
| value | string |
The description. |
Get fileName string
Gets the file name of the attachment.
Set fileName void
Sets the file name of the attachment.
| Parameter | Type | Description |
|---|---|---|
| value | string |
The file name. |
Get index number
Gets the current zero-based index of this attachment in the owning document.
Get mimeType string
Gets the MIME type of the attachment.
Set mimeType void
Sets the MIME type of the attachment.
| Parameter | Type | Description |
|---|---|---|
| value | string |
The MIME type string (e.g. "text/plain"). |
Get modificationDate Date
Gets the modification date of the attachment.
Set modificationDate void
Sets the modification date of the attachment.
| Parameter | Type | Description |
|---|---|---|
| value | Date |
The modification date. |
Get relationship PdfAttachmentRelationship
Gets the relationship of the attachment to the document content.
Set relationship void
Sets the relationship of the attachment to the document content.
| Parameter | Type | Description |
|---|---|---|
| value | PdfAttachmentRelationship |
The relationship value. |
Methods
_initialize
Initializes ownership and stream reference for a parsed or added attachment.
| Parameter | Type | Description |
|---|---|---|
| owner | Object |
The owner document attachment collection host. |
| embeddedFileRef | _PdfEmbeddedFileRef |
The embedded-file reference. |
| index | number |
The zero-based attachment index. |
Returns void