Skip to main content
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

NameTypeDescription
ApplicationEngine, read-onlyReturns the Engine object.
BindingPDFAttachmentBindingEnum, read-onlySpecifies 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.
DescriptionBSTR, read-onlyReturns the description given to the file when it was attached.
FileFormatImageFileFormatEnum, read-onlyReturns 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 method. Otherwise, you can save the attachment using the SaveToFile or SaveToMemory (Win) method. </Note>
FileNameBSTR, read-onlyReturns the original file name.

Methods

NameDescription
SaveToFileSaves the attached file on disk.
SaveToMemory <Note> Windows only </Note>Saves the attached file into the global memory.
PDFAttachment Object Diagram

Input parameter

This object is passed as an input parameter to the AddImageFileFromAttachment method.

Output parameter

This object is the output parameter of the AddFromFile, AddFromMemory (Win) methods of the PDFAttachments object.

Samples

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 );     

See also

PDFAttachments ZUGFeRD-compliant electronic invoices