> ## 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.

# PDFAttachment Object (IPDFAttachment Interface)

This object represents a PDF attachment. It provides access to the original file name, description added by the author, and the type of binding of the attachment. It also exposes methods that allow you to access the attached file by saving it on disk or into the global memory.

## Properties

| Name        | Type                                                                                                                                                                                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Application | [Engine](/fine-reader/engine/api-reference/engine-object-iengine-interface), [read-only](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties) | Returns the Engine object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Binding     | [PDFAttachmentBindingEnum](/fine-reader/engine/api-reference/enumerations/pdfattachmentbindingenum), read-only                                                                                                | Specifies if the attached file is associated with one annotation, PDF Portfolio, or the document in general. For an attachment added via FineReader Engine API, this property value is always PAB\\\_Document.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Description | [BSTR](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties), read-only                                                                                            | Returns the description given to the file when it was attached.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| FileFormat  | [ImageFileFormatEnum](/fine-reader/engine/api-reference/enumerations/imagefileformatenum), read-only                                                                                                          | Returns the original file format defined after its opening by ABBYY FineReader Engine. <Note> If the attachment format is not equal to IFF\\\_UnknownFormat, then it can be used in the [AddImageFileFromAttachment](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefilefromattachment-method) method. Otherwise, you can save the attachment using the [SaveToFile](/fine-reader/engine/api-reference/document-related-objects/pdfattachment/savetofile-method) or [SaveToMemory](/fine-reader/engine/api-reference/document-related-objects/pdfattachment/savetomemory-method) (Win) method. </Note> |
| FileName    | [BSTR](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties), read-only                                                                                            | Returns the original file name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Methods

| Name                                                                                                                                                | Description                                     |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| [SaveToFile](/fine-reader/engine/api-reference/document-related-objects/pdfattachment/savetofile-method)                                            | Saves the attached file on disk.                |
| [SaveToMemory](/fine-reader/engine/api-reference/document-related-objects/pdfattachment/savetomemory-method) <br /><br /> **Note:** *Windows only.* | Saves the attached file into the global memory. |

## Related objects

<img src="https://mintcdn.com/abbyy/i-EfCQVmseNiPQcp/images/fine-reader/engine/pdfattachment.gif?s=47cc0fb96ddc68f5ac394428baae2e58" alt="PDFAttachment" width="166" height="93" data-path="images/fine-reader/engine/pdfattachment.gif" />[](/fine-reader/engine/api-reference/document-related-objects/pdfattachments)[](/fine-reader/engine/visual-components-reference/supplementary-objects/spellwordcollection/element-property)[](/fine-reader/engine/api-reference/document-related-objects/frdocument#pdfattachments)[](/fine-reader/engine/api-reference/document-related-objects/frdocument)

[Object Diagram](/fine-reader/engine/api-reference/object-diagram)

## Input parameter

This object is passed as an input parameter to the [AddImageFileFromAttachment](/fine-reader/engine/api-reference/document-related-objects/frdocument/addimagefilefromattachment-method) method.

## Output parameter

This object is the output parameter of the [AddFromFile](/fine-reader/engine/api-reference/document-related-objects/pdfattachments/addfromfile-method), [AddFromMemory](/fine-reader/engine/api-reference/document-related-objects/pdfattachments/addfrommemory-method) (Win) methods of the [PDFAttachments](/fine-reader/engine/api-reference/document-related-objects/pdfattachments) object.

## Samples

<Accordion title="C++ (COM) code">
  ```cpp theme={null}
  FREngine::IEnginePtr Engine;
  FREngine::IFRDocumentPtr sourceFile = Engine->CreateFRDocument();
  sourceFile->AddImageFile( imageFilePath, 0, 0 );
  // Get attachment collection from source document
  FREngine::IPDFAttachmentsPtr attachments;
  sourceFile->get_PDFAttachments( &attachments );
  int attachmentsCount( 0 );
  attachments->get_Count( &attachmentsCount );
  // Add images from attachments to a new document for processing
  FREngine::IFRDocumentPtr frDocument = Engine->CreateFRDocument();
  for( int j = 0; j < attachmentsCount; j++ ) {
      FREngine::IPDFAttachmentPtr attach;
      attachments->get_Element( j, &attach );
      FREngine::ImageFileFormatEnum fileFormat( FREngine::IFF_UnknownFormat );
      attach->get_FileFormat( &fileFormat );
      // Only supported ImageFileFormatEnum can be processed
      if( fileFormat != FREngine::IFF_UnknownFormat ) {
          frDocument->AddImageFileFromAttachment( attach, 0, 0, 0 );
      } else {
      // All attachments can be saved
          BSTR fileName;
          attach->get_FileName( &fileName );
          attach->SaveToFile( fileName );
      }
  }
   // Recognize document
   frDocument->Process( 0 );     
  ```
</Accordion>

## See also

[PDFAttachments](/fine-reader/engine/api-reference/document-related-objects/pdfattachments)

[ZUGFeRD-compliant electronic invoices](/fine-reader/engine/guided-tour/advanced-techniques/zugferd-compliant-electronic-invoices)
