←Select platform

ReadAttachments(Stream) Method


Reads the properties of the attachments embedded in the specified stream.

public CodecsAttachments ReadAttachments( 
   Stream stream 
vb[VB Syntax] 
Public Function ReadAttachments( 
   ByVal _stream_ As Stream 
) As CodecsAttachments 
   CodecsAttachments^ ReadAttachments( 
      Stream^ stream 



Stream containing the owner file that may contain embedded attachments.

Return Value

Collection of CodecsAttachment objects containing the properties of any attachments found. If the owner file neither contains nor supports attachments, then an empty collection is returned.


This method returns an empty collection in the following situations:

  • The owner file does not contain any attachments
  • The owner file does not support attachments
  • The owner file supports attachments, but reading support is not available in this version of the LEADTOOLS toolkit

The number of attachment items returned by this method is the same as the CodecsImageInfo.AttachmentCount value of the object returned by GetInformation.

Each CodecsAttachment contains the properties of its attachment such as its FileName, FileLength, and other extra information provided by the owner document.

Use ExtractAttachment to extract the binary content of an attachment file onto an output disk file or stream for further processing. Examples of further processing include calling GetInformation or Load.

LEADTOOLS supports reading the attachments embedded in the following file formats:


PDF files support embedded attachments of any number and file format (PDF, TIFF, XML, etc). PDF files can also be created as a portfolio which contains multiple files assembled into an integrated unit. In these types of documents, the file contains a single generic help page with text such as "For the best experience, open this PDF portfolio in a compatible viewer" and any number of attachments and a schema to control how to view the document. The value of CodecsImageInfo.IsPortfolio will be true if the file is a PDF portfolio; it is up to the application to determine how to further handle the file.


For an example, refer to ReadAttachments(string).


Target Platforms

Help Version 22.0.2022.4.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2022 LEAD Technologies, Inc. All Rights Reserved.