GroupDocs.Viewer For .NET 3.3.0 Release Notes

This page contains release notes for GroupDocs.Viewer for .NET 3.3.0

Major Features

There are 33 improvements and fixes in this regular monthly release. The most notable are:

  • Introduced option to specify custom fonts path.
  • Introduced new methods for working with email attachments.
  • Introduced new methods for getting info for remotely located document or document in the form of stream.
  • Introduced ability to clear cache.
  • Introduced options to set opacity setting for watermark in html mode.
  • Improved rendering performance.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
VIEWERNET-631Add ability to specify custom fonts pathNew Feature
VIEWERNET-475Opacity setting for WatermarkNew Feature
VIEWERNET-416Get selected attachment from email documentsNew Feature
VIEWERNET-414Render attachments from email documentsNew Feature
VIEWERNET-478Pre-Render Information required of a remotely located document or document in the form of streamsNew Feature
VIEWERNET-459Provide remove old cache utility feature in the next generation APINew Feature
VIEWERNET-582The GroupDocs.Viewer 3.x is slower than 2.19 in performanceImprovement
VIEWERNET-641Update DocumentInfoOptions Cells/Words/Email DocumentInfoOptions properties names and typesImprovement
VIEWERNET-640Remove duplicated document name header in Project document converted to htmlImprovement
VIEWERNET-636Remove border in html that was converted from words documentImprovement
VIEWERNET-619Implement adding prefix to font-family property if it can be overridenImprovement
VIEWERNET-614Implement transparent watermarking in html modeImprovement
VIEWERNET-600Improve performance of extracting document information in image modeImprovement
VIEWERNET-590Apply HtmlResourcePrefix to fonts mentioned in css filesImprovement
VIEWERNET-568Load document only when not cachedImprovement
VIEWERNET-557Improve temp files folder structureImprovement
VIEWERNET-558Improve processing remote files by UriImprovement
WEB-1107Convert a document page to JPEG in about 0.1 secondImprovement
WEB-905Links for mail attachmentsImprovement
VIEWERNET-642GetDocumentInfo Method Throws Exception in Evaluation ModeBug
VIEWERNET-632The HtmlResourcePrefix {page-number} is not set in DiagramToHtmlConverterBug
VIEWERNET-476Some characters are not showing in correct format when render as HTMLBug
VIEWERNET-591‘System.OutOfMemoryException’ thrown while rendering as imageBug
VIEWERNET-605Only first frame or tiff document converted in image modeBug
VIEWERNET-606Only first frame or tiff document converted in image modeBug
VIEWERNET-550MSG file is not rendering properlyBug
VIEWERNET-583Failed to get document information in image mode with text from epub documentBug
VIEWERNET-570Failed to get document information in image mode with text in trialBug
VIEWERNET-551File description document type format is Unknown when extension is upper caseBug
VIEWERNET-552File description document type format is Unknown when extension is upper caseBug
WEB-2372Different HTML generated for the same documentBug
WEB-1531Outlines are rendered incorrectly in HTMLBug
WEB-2320Some text extracted from document twiceBug

Public API and Backward Incompatible Changes

Set custom fonts directory path

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Add custom fonts directories to FontDirectories list
config.FontDirectories.Add(@"/usr/admin/Fonts");
config.FontDirectories.Add(@"/home/admin/Fonts");
 
// Init viewer handler with config
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);

Get email attachment original file

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Create image handler
ViewerImageHandler handler = new ViewerImageHandler(config);
EmailAttachment attachment = new EmailAttachment("document-with-attachments.msg", "attachment-image.png");
  
// Get attachment original file
FileContainer container = imageHandler.GetFile(attachment);
Console.WriteLine("Attach name: {0}, size: {1}", attachment.Name, attachment.FileType);
Console.WriteLine("Attach stream lenght: {0}", fileContainer.Stream.Length);

Get attachment document html representation

// Setup GroupDocs.Viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = "c:\\storage";
viewerConfig.UseCache = true;
 
// Setup html conversion options
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.IsResourcesEmbedded = false;
  
// Init viewer html handler
ViewerHtmlHandler handler = new ViewerHtmlHandler(viewerConfig);
 
DocumentInfoContainer info = handler.GetDocumentInfo("document-with-attachments.msg");
 
// 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 html representation
    List<PageHtml> pages = handler.GetPages(attachment, htmlOptions);
    foreach (PageHtml page in pages)
    {
        Console.WriteLine("  Page: {0}, size: {1}", page.PageNumber, page.HtmlContent.Length);
        foreach (HtmlResource htmlResource in page.HtmlResources)
        {
            Stream resourceStream = handler.GetResource(attachment, htmlResource);
            Console.WriteLine("     Resource: {0}, size: {1}", htmlResource.ResourceName, resourceStream.Length);
        }
    }
}

Get attachment document image representation

// Setup GroupDocs.Viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = "c:\\storage";
viewerConfig.UseCache = true;
  
// Init viewer image handler
ViewerImageHandler handler = new ViewerImageHandler(viewerConfig);
 
DocumentInfoContainer info = handler.GetDocumentInfo("document-with-attachments.msg");
 
// 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, htmlOptions);
    foreach (PageImage page in pages)
        Console.WriteLine("  Page: {0}, size: {1}", page.PageNumber, page.Stream.Length);
}

Get document information by guid

The following code snippet shows you how to get document information by guid in Viewer v.3.3.0

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
 
string guid = "word.doc";
// Get document information
DocumentInfoOptions options = new DocumentInfoOptions();
DocumentInfoContainer documentInfo = htmlHandler.GetDocumentInfo(guid, options);
 
Console.WriteLine("DateCreated: {0}", documentInfo.DateCreated);
Console.WriteLine("DocumentType: {0}", documentInfo.DocumentType);
Console.WriteLine("DocumentTypeFormat: {0}", documentInfo.DocumentTypeFormat);
Console.WriteLine("Extension: {0}", documentInfo.Extension);
Console.WriteLine("FileType: {0}", documentInfo.FileType);
Console.WriteLine("Guid: {0}", documentInfo
Console.WriteLine("LastModificationDate: {0}", documentInfo.LastModificationDate);
Console.WriteLine("Name: {0}", documentInfo.Name);
Console.WriteLine("PageCount: {0}", documentInfo.Pages.Count);
Console.WriteLine("Size: {0}", documentInfo.Size);
 
foreach (PageData pageData in documentInfo.Pages)
{
    Console.WriteLine("Page number: {0}", pageData.Number);
    Console.WriteLine("Page name: {0}", pageData.Name);
}

Get document information by stream

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
 
// Get document stream
Stream stream = GetDocumentStream();
// Get document information
DocumentInfoOptions options = new DocumentInfoOptions();
DocumentInfoContainer documentInfo = htmlHandler.GetDocumentInfo(stream, options);
 
Console.WriteLine("DateCreated: {0}", documentInfo.DateCreated);
Console.WriteLine("DocumentType: {0}", documentInfo.DocumentType);
Console.WriteLine("DocumentTypeFormat: {0}", documentInfo.DocumentTypeFormat);
Console.WriteLine("Extension: {0}", documentInfo.Extension);
Console.WriteLine("FileType: {0}", documentInfo.FileType);
Console.WriteLine("Guid: {0}", documentInfo
Console.WriteLine("LastModificationDate: {0}", documentInfo.LastModificationDate);
Console.WriteLine("Name: {0}", documentInfo.Name);
Console.WriteLine("PageCount: {0}", documentInfo.Pages.Count);
Console.WriteLine("Size: {0}", documentInfo.Size);
 
foreach (PageData pageData in documentInfo.Pages)
{
    Console.WriteLine("Page number: {0}", pageData.Number);
    Console.WriteLine("Page name: {0}", pageData.Name);
}

Get document information by Uri

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
 
Uri uri = new Uri("http://example.com/words.doc");
 
// Get document information
DocumentInfoOptions options = new DocumentInfoOptions();
DocumentInfoContainer documentInfo = htmlHandler.GetDocumentInfo(uri, options);
 
Console.WriteLine("DateCreated: {0}", documentInfo.DateCreated);
Console.WriteLine("DocumentType: {0}", documentInfo.DocumentType);
Console.WriteLine("DocumentTypeFormat: {0}", documentInfo.DocumentTypeFormat);
Console.WriteLine("Extension: {0}", documentInfo.Extension);
Console.WriteLine("FileType: {0}", documentInfo.FileType);
Console.WriteLine("Guid: {0}", documentInfo
Console.WriteLine("LastModificationDate: {0}", documentInfo.LastModificationDate);
Console.WriteLine("Name: {0}", documentInfo.Name);
Console.WriteLine("PageCount: {0}", documentInfo.Pages.Count);
Console.WriteLine("Size: {0}", documentInfo.Size);
 
foreach (PageData pageData in documentInfo.Pages)
{
    Console.WriteLine("Page number: {0}", pageData.Number);
    Console.WriteLine("Page name: {0}", pageData.Name);
}

How to clear all cache files

//Init viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = "c:\\storage";
 
// Init viewer image or html handler
ViewerImageHandler viewerImageHandler = new ViewerImageHandler(viewerConfig);
 
//Clear all cache files 
viewerImageHandler.ClearCache();

How to clear files from cache older than specified time interval

//Init viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = "c:\\storage";
 
// Init viewer image or html handler
ViewerImageHandler viewerImageHandler = new ViewerImageHandler(viewerConfig);
 
//Clear files from cache older than specified time interval
TimeSpan olderThanTwoDays = TimeSpan.FromDays(2);
viewerImageHandler.ClearCache(olderThanTwoDays)