# PdfAttachmentEditSession

Mutable attachment collection used by one existing-document attachment edit.

Class 

`OfficeIMO.Pdf`

**Namespace**

`OfficeIMO.Pdf`

**Assembly**

`OfficeIMO.Pdf`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[PdfAttachmentEditSession.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Manipulation/PdfAttachmentEditSession.cs#L48)

**Modifiers**

sealed

Mutable attachment collection used by one existing-document attachment edit.

## Inheritance

- object
- PdfAttachmentEditSession

## Usage

Explore 5 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 4

- Method [PdfAttachmentEditSession.Add](/api/pdf/officeimo-pdf-pdfattachmenteditsession/#method-add-officeimo-pdf-pdfembeddedfile)
- Method [PdfAttachmentEditSession.Remove](/api/pdf/officeimo-pdf-pdfattachmenteditsession/#method-remove-string)
- Method [PdfAttachmentEditSession.Rename](/api/pdf/officeimo-pdf-pdfattachmenteditsession/#method-rename-string-string)
- Method [PdfAttachmentEditSession.Replace](/api/pdf/officeimo-pdf-pdfattachmenteditsession/#method-replace-string-officeimo-pdf-pdfembeddedfile)

### Accepted by parameters 1

- Method [PdfDocumentAttachments.Edit](/api/pdf/officeimo-pdf-pdfdocumentattachments/#method-edit-action-officeimo-pdf-pdfattachmenteditsession) parameter `edit`

Filter members 

Show inherited

## Methods

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

[PdfAttachmentEditSession.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Manipulation/PdfAttachmentEditSession.cs#L48)

Adds a uniquely named attachment after admitting its payload against the target collection budget.

Parameters

**attachment OfficeIMO.Pdf.PdfEmbeddedFile required**

Returns

`PdfAttachmentEditSession`

Exceptions

- `PdfReadLimitException` – The target collection exceeds its aggregate attachment-byte limit.

Remove 2 overloads

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

[PdfAttachmentEditSession.cs:84](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Manipulation/PdfAttachmentEditSession.cs#L84)

Removes an attachment by file name.

Parameters

**fileName string required**

Returns

`PdfAttachmentEditSession`

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

[PdfAttachmentEditSession.cs:90](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Manipulation/PdfAttachmentEditSession.cs#L90)

Removes one source attachment by its file-spec and embedded-stream identity.

Parameters

**attachment OfficeIMO.Pdf.PdfAttachmentInfo required**

Returns

`PdfAttachmentEditSession`

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

[PdfAttachmentEditSession.cs:74](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Manipulation/PdfAttachmentEditSession.cs#L74)

Renames an attachment while preserving payload and metadata.

Parameters

**fileName string required**

**newFileName string required**

Returns

`PdfAttachmentEditSession`

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

[PdfAttachmentEditSession.cs:60](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Manipulation/PdfAttachmentEditSession.cs#L60)

Replaces the attachment identified by file name, admitting the net payload before changing the collection.

Parameters

**fileName string required**

**replacement OfficeIMO.Pdf.PdfEmbeddedFile required**

Returns

`PdfAttachmentEditSession`

Exceptions

- `PdfReadLimitException` – The target collection exceeds its aggregate attachment-byte limit.

## 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?`

## Properties

`public IReadOnlyList<PdfEmbeddedFile> Attachments { get; }` [#](#property-attachments)

[PdfAttachmentEditSession.cs:43](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Pdf/Manipulation/PdfAttachmentEditSession.cs#L43)

Current attachment snapshots in edit order.

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