GroupDocsGists
10/19/2017 - 11:21 AM

GetEmailAttachmentImageRepresentation.cs

// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Setup GroupDocs.Viewer config
ViewerConfig config = Utilities.GetConfigurations();

// Init viewer image handler
ViewerImageHandler handler = new ViewerImageHandler(config);

DocumentInfoContainer info = handler.GetDocumentInfo(DocumentName);

// Iterate over the attachments collection
foreach (AttachmentBase attachment in info.Attachments)
{
    Console.WriteLine("Attach name: {0}, size: {1}", attachment.Name, attachment.FileType);

    // Get attachment document image representation
    List<PageImage> pages = handler.GetPages(attachment);
    foreach (PageImage page in pages)
        Console.WriteLine("  Page: {0}, size: {1}", page.PageNumber, page.Stream.Length);
}