# PdfDocumentAttachments

Existing-document embedded and associated file editing operations.

Class 

`OfficeIMO.Pdf`

**Namespace**

`OfficeIMO.Pdf`

**Assembly**

`OfficeIMO.Pdf`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[PdfDocumentAttachments.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L9)

**Modifiers**

sealed

Existing-document embedded and associated file editing operations.

## Inheritance

- object
- PdfDocumentAttachments

## Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 1

- Property [PdfDocument.Attachments](/api/pdf/officeimo-pdf-pdfdocument/#property-attachments)

Filter members 

Show inherited

## Methods

`public PdfAttachmentEditResult Add(PdfEmbeddedFile attachment)` [#](#method-add-officeimo-pdf-pdfembeddedfile)

[PdfDocumentAttachments.cs:35](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L35)

Adds one attachment.

Parameters

**attachment OfficeIMO.Pdf.PdfEmbeddedFile required**

Returns

`PdfAttachmentEditResult`

`public PdfAttachmentEditResult Edit(Action<PdfAttachmentEditSession> edit)` [#](#method-edit-action-officeimo-pdf-pdfattachmenteditsession)

[PdfDocumentAttachments.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L33)

Applies a transactional attachment collection edit.

Parameters

**edit System.Action<OfficeIMO.Pdf.PdfAttachmentEditSession> required**

Returns

`PdfAttachmentEditResult`

Extract 2 overloads

`public IReadOnlyList<PdfExtractedAttachment> Extract(PdfLoadOptions? readOptions = null)` [#](#method-extract-officeimo-pdf-pdfloadoptions)

[PdfDocumentAttachments.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L9)

Extracts every embedded or associated file payload.

Parameters

**readOptions OfficeIMO.Pdf.PdfLoadOptions? = null optional**

Returns

`IReadOnlyList<PdfExtractedAttachment>`

`public PdfExtractedAttachment Extract(PdfAttachmentInfo attachment, long maximumDecodedBytes, CancellationToken cancellationToken = default)` [#](#method-extract-officeimo-pdf-pdfattachmentinfo-int64-threading-cancellationtoken)

[PdfDocumentAttachments.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L13)

Extracts one selected attachment without decoding unrelated payloads.

Parameters

**attachment OfficeIMO.Pdf.PdfAttachmentInfo required**

**maximumDecodedBytes long required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`PdfExtractedAttachment`

Remove 2 overloads

`public PdfAttachmentEditResult Remove(string fileName)` [#](#method-remove-string)

[PdfDocumentAttachments.cs:41](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L41)

Removes one attachment.

Parameters

**fileName string required**

Returns

`PdfAttachmentEditResult`

`public PdfAttachmentEditResult Remove(PdfAttachmentInfo attachment)` [#](#method-remove-officeimo-pdf-pdfattachmentinfo)

[PdfDocumentAttachments.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L44)

Removes one selected attachment by its source object identity.

Parameters

**attachment OfficeIMO.Pdf.PdfAttachmentInfo required**

Returns

`PdfAttachmentEditResult`

`public PdfAttachmentEditResult Rename(string fileName, string newFileName)` [#](#method-rename-string-string)

[PdfDocumentAttachments.cs:39](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L39)

Renames one attachment.

Parameters

**fileName string required**

**newFileName string required**

Returns

`PdfAttachmentEditResult`

`public PdfAttachmentEditResult Replace(string fileName, PdfEmbeddedFile replacement)` [#](#method-replace-string-officeimo-pdf-pdfembeddedfile)

[PdfDocumentAttachments.cs:37](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Core/PdfDocumentAttachments.cs#L37)

Replaces one attachment by file name.

Parameters

**fileName string required**

**replacement OfficeIMO.Pdf.PdfEmbeddedFile required**

Returns

`PdfAttachmentEditResult`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:C2F4FB01A24017FB6E78239F8A6515098B2644DFC4086C07490491B30AC512C0 -->
