GroupDocs.Viewer for .NET 17.9 Release Notes

Major Features

There are 2 new features and 12 improvements and fixes in this regular monthly release. The most notable are:

  • Setting to exclude fonts while rendering into HTML
  • Setting to exclude default fonts when rendering Presentation documents
  • Responsive output for rendering MS Visio documents and SVG images into HTML
  • Responsive output for Text documents with HtmlOptions.EnableResponsiveRendering setting

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
VIEWERNET-1343GIF images are displayed without animationNew Feature
VIEWERNET-1263Implement a setting for excluding fonts while rendering into HTMLNew Feature
VIEWERNET-1336Show local time when rendering Email messagesImprovement
VIEWERNET-1323Implement responsive output for rendering MS Visio documents and SVG images into HTMLImprovement
VIEWERNET-1311Extend support for HtmlOptions.EnableResponsiveRendering to Text documentsImprovement
VIEWERNET-1261Improve rendering into HTML for rotated documentsImprovement
WEB-1407It takes hours of time and gigabytes of RAM to convert a DOCX of 1758 pagesBug
VIEWERNET-1335Issue with recipient and sent date when rendering from .eml message to imageBug
VIEWERNET-1257File extension field does not include periodBug
VIEWERNET-1202Incorrect position of parenthesis in output HTMLBug
VIEWERNET-1178Out Of Memory Exception when rendering PDF into imageBug
VIEWERNET-1159Blank output HTML page when rendering PDF documentBug
VIEWERNET-1136Misplaced Characters when Viewing HTML in Safari for iOSBug
VIEWERNET-1004Alignment of radio button text and checkbox text is not properBug

Public API and Backward Incompatible Changes

Excluding fonts when rendering to HTML

When we are rendering documents into HTML, by default the fonts that are used in the document are added into HTML content. This ensures fonts availability so that you can be pretty sure that the text from the original document will appear similar in the HTML, regardless of whether the fonts are installed on the viewer’s device or not. Depending on IsResourceEmbedded option of HtmlOptions class the fonts are added inline as base64-encoded fonts or as external resources. Embedded fonts increase the size of the rendering result, in order to prevent adding fonts into HTML, set ExcludeFonts property of HtmlOptions class as true as shown in the example below:

Use ExcludeFonts = true to prevent adding fonts in HTML representations

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = "word.doc";
 
HtmlOptions options = new HtmlOptions();
options.ExcludeFonts = true;
List<PageHtml> pages = htmlHandler.GetPages(guid, options);
 
 
foreach (PageHtml page in pages)
{
    Console.WriteLine("Page number: {0}", page.PageNumber);
    Console.WriteLine("Html content: {0}", page.HtmlContent);
}

Rendering Document into Responsive HTML

Set EnableResponsiveRendering = true to get responsive html representations.

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = "CadDrawing.dwg";
 
HtmlOptions options = new HtmlOptions();
options.EnableResponsiveRendering = true;
List<PageHtml> pages = htmlHandler.GetPages(guid, options);
 
 
foreach (PageHtml page in pages)
{
    Console.WriteLine("Page number: {0}", page.PageNumber);
    Console.WriteLine("Html content: {0}", page.HtmlContent);
}

Please note that, currently, this option works for most document types, but there are few (listed below) that are not supported yet. We are planning to extend support for this option in upcoming releases.

List of document types that do not support responsive rendering.

Format NameExtension
Portable Document FormatPDF
Microsoft ExcelXLS, XLSX, XLSM, XLSB
Microsoft PowerPointPPT, PPTX, PPS, PPSX
Microsoft ProjectMPP, MPT
OpenDocument FormatsODS, ODP, OTP, OTS
Plain Text FileTXT
Comma-Separated ValuesCSV
HyperText Markup LanguageHTML, MHT, MHTML
Extensible Markup LanguageXML
XML Paper SpecificationXPS
Electronic publicationEPUB
Mobipocket e-book formatMOBI
LaTeXTEX

List of changes in GroupDocs.Viewer for .NET 17.9.0

GroupDocs.Viewer.Config.ViewerConfig

Public bool UsePdf obsolete property has been removed

Please use ImageOptions.ExtractText or DocumentInfoOptions.ExtractText  settings instead, as shown in example below.

Get text coordinates in image mode

v17.6.0 and higher

//Init viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = "c:\\storage";
 
// Set document guid
string guid = "document.doc";
 
// Init viewer image handler
ViewerImageHandler viewerImageHandler = new ViewerImageHandler(viewerConfig);
 
//Get document info
DocumentInfoOptions documentInfoOptions = new DocumentInfoOptions();
documentInfoOptions.ExtractText = true;
DocumentInfoContainer documentInfoContainer = viewerImageHandler.GetDocumentInfo(guid, documentInfoOptions);
 
// Go through all pages
foreach (PageData pageData in documentInfoContainer.Pages)
{
    Console.WriteLine("Page number: " + pageData.Number);
  
    //Go through all page rows
    for (int i = 0; i < pageData.Rows.Count; i++)
    {
        RowData rowData = pageData.Rows[i];
 
        // Write data to console
        Console.WriteLine("Row: " + (i + 1));
        Console.WriteLine("Text: " + rowData.Text);
        Console.WriteLine("Text width: " + rowData.LineWidth);
        Console.WriteLine("Text height: " + rowData.LineHeight);
        Console.WriteLine("Distance from left: " + rowData.LineLeft);
        Console.WriteLine("Distance from top: " + rowData.LineTop);
 
        // Get words
        string[] words = rowData.Text.Split(' ');
 
        // Go through all word coordinates
        for (int j = 0; j < words.Length; j++)
        {
            int coordinateIndex = j == 0 ? 0 : j + 1;
 
            // Write data to console
            Console.WriteLine(string.Empty);
            Console.WriteLine("Word: '" + words[j] + "'");
            Console.WriteLine("Word distance from left: " + rowData.TextCoordinates[coordinateIndex]);
            Console.WriteLine("Word width: " + rowData.TextCoordinates[coordinateIndex + 1]);
            Console.WriteLine(string.Empty);
        }
    }
}

GroupDocs.Viewer.Converter.Options.PdfOptions

Public bool DeleteAnnotations is set as obsolete

This property is obsolete and will be removed in version 17.12. Please use RenderComments property of the HtmlOptions or ImageOptions class instead.

GroupDocs.Viewer.Domain.EmailAttachment

Public GroupDocs.Viewer.Domain.EmailAttachment obsolete class and class members have been removed

Please use GroupDocs.Viewer.Domain.Attachment class instead as shown in the example below.

Get text coordinates in image mode

Loading email attachments using obsolete and new class

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
 
// Create attachment object and print out its name and file type
Attachment attachment = new Attachment("document-with-attachments.msg", "attachment-image.png");
Console.WriteLine("Attach name: {0}, size: {1}", attachment.Name, attachment.FileType);
 
// Get attachment original file and print out Stream length
using (FileContainer fileContainer = imageHandler.GetFile(attachment))
{
    Console.WriteLine("Attach stream lenght: {0}", fileContainer.Stream.Length);
}

GroupDocs.Viewer.Domain.EmailFileData

Public GroupDocs.Viewer.Domain.EmailFileData class and class members have been removed

Please use FileData class instead. 

GroupDocs.Viewer.Domain.FileData

Public bool IsComplete property has been removed

There is no replacement for this property.

GroupDocs.Viewer.Handler.IInputDataHandler

Public GroupDocs.Viewer.Handler.IInputDataHandler interface AddFile(string guid, Stream content) method compilation is set to fail

This method is obsolete and will be removed in the next version.