> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AddImageFileFromAttachment Method of the FRDocument Object

This method opens an image file from the attachment and adds the pages corresponding to the opened file to the document.

## Syntax

### C++

```cpp theme={null}
HRESULT AddImageFileFromAttachment(
  IPDFAttachment*         Attachment,
  IImagePasswordCallback* Callback,
  IPrepareImageMode*      PrepareMode,
  IIntsCollection*        PageIndices
);
```

### C\#

```csharp theme={null}
void AddImageFileFromAttachment(
  IPDFAttachment          Attachment,
  IImagePasswordCallback  Callback,
  IPrepareImageMode       PrepareMode,
  IIntsCollection         PageIndices
);
```

### Visual Basic .NET

```vb theme={null}
Sub AddImageFileFromAttachment( _
  Attachment As IPDFAttachment, _
  Callback As IImagePasswordCallback, _
  [PrepareMode As IPrepareImageMode = Nothing], _
  [PageIndices As IIntsCollection = Nothing] _
)
```

## Parameters

Attachment

\[in] This parameter of the [IPDFAttachment](/fine-reader/engine/api-reference/document-related-objects/pdfattachment) type represents the PDF attachment to be added. This method uses files whose [formats](/fine-reader/engine/api-reference/document-related-objects/pdfattachment) were defined by ABBYY FineReader Engine.

Callback

\[in] This parameter refers to the interface of the user-implemented object of the type [ImagePasswordCallback](/fine-reader/engine/api-reference/image-related-objects/iimagepasswordcallback) which is used to handle possible password requests for accessing images in PDF format. This parameter is optional and may be 0, in which case password-protected files cannot be processed.

PrepareMode

\[in] Refers to the [PrepareImageMode](/fine-reader/engine/api-reference/image-related-objects/prepareimagemode) object which specifies how an image will be preprocessed during opening. This parameter is optional and may be 0, in which case either the default parameters are used, or, if a [profile](/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles) has been loaded, the parameters set by this profile are used.

PageIndices

\[in] This parameter refers to the [IntsCollection](/fine-reader/engine/api-reference/supplementary-objects-and-methods/intscollection) object which specifies the indices of the pages which have to be added to the document. Note that repeated indices are not allowed. To add the same page several times, please call this method several times.<br />This parameter is optional and may be 0, in which case all the pages of the opened file will be added to the document.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## Remarks

<Note>
  These remarks are Linux and Windows only.
</Note>

* If your license includes the [Office Formats Opening](/fine-reader/engine/licensing/modules#officeformatsopening) module, you may also use this method to open digital documents of [supported formats](/fine-reader/engine/specifications/supported-digital-document-input-formats).
* Depending on the value of the [IEngine::MultiProcessingParams](/fine-reader/engine/api-reference/engine-object-iengine-interface/properties#multiprocessingparams) property, ABBYY FineReader Engine can distribute opening of multi-page documents to CPU cores.
* For Linux, this method does not work if the Engine object is loaded as an out-of-process server.

## See also

[FRDocument](/fine-reader/engine/api-reference/document-related-objects/frdocument)
