GroupDocs.Viewer for .NET 17.8.0 Release Notes

Major Features

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

  • Responsive output for rendering into HTML
  • Setting to ignore HTML Resource Prefix in resources
  • Implemented feature to show comments when rendering Spreadsheet documents as HTML
  • Implemented feature to show comments when rendering Presentation documents
  • Implemented feature to ignore empty rows when rendering Spreadsheet documents
  • Added DNG image file format support
  • Added Microsoft Visio VSTM, VSSM and VSDM file formats support

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
VIEWERNET-1322Export styles that make page responsive when resources are not embeddedNew Feature
VIEWERNET-1315Implement a setting for ignoring HTML Resource Prefix in resourcesNew Feature
VIEWERNET-1307Show comments when rendering Spreadsheet documents as HTMLNew Feature
VIEWERNET-1305Ignore empty rows when rendering Spreadsheet documentsNew Feature
VIEWERNET-1292Add DNG image file format supportNew Feature
VIEWERNET-1260Add VSTM file format supportNew Feature
VIEWERNET-1259Add VSSM file format supportNew Feature
VIEWERNET-1258Add VSDM file format supportNew Feature
VIEWERNET-1191Show comments when rendering Presentation documentsNew Feature
VIEWERNET-1321Improve setting prefix for fonts when rendering Text document as HTMLImprovement
VIEWERNET-1314Use single naming convention for HTML resourcesImprovement
VIEWERNET-1306Use ICacheDataHandler instead of IFileDataStoreImprovement
VIEWERNET-1296Implement responsive output for rendering into HTMLImprovement
VIEWERNET-1303Exception when rendering Excel document into HTML and imageBug
VIEWERNET-1297Exception when rendering email message containing .msg file as attachmentBug
VIEWERNET-1241“Index was out of range” exception when rendering PDF to HtmlBug
VIEWERNET-1189Unable to render Word document having AD RMS templateBug
VIEWERNET-1148Unable to render PDF document in HTML/Image modeBug
VIEWERNET-1063Rendering MS Project document stops respondingBug
VIEWERNET-1017Check boxes in PDF document are not rendered correctlyBug

Public API and Backward Incompatible Changes

Ignoring resource prefix for HTML resources

Ignoring resource prefix using IgnorePrefixInResources

HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.HtmlResourcePrefix = "http://contoso.com/api/getResource?name="
htmlOptions.IgnorePrefixInResources = true;

Rendering documents with Comments

Rendering document with comments.

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
  
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = "document.pptx";
  
// Set words options to render content with comments
HtmlOptions options = new HtmlOptions();
options.RenderComments = true; // Default value is false
 
// Get pages 
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);
}

Getting PDF representation of document with comments.

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
  
// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
string guid = "document.pptx";
  
// Set pdf options to get pdf file with comments
PdfFileOptions options = new PdfFileOptions();
options.RenderComments = true; // Default value is false
 
// Get pdf document with comments
FileContainer fileContainer = imageHandler.GetPdfFile(guid, pdfFileOptions);
// Access result pdf document using fileContainer.Stream property

Ignoring empty rows when rendering Cells documents

Sometimes Cells document contains information in the beginning of the worksheet and after that, it contains some count of empty (blank) rows and information again e.g. summary row. Starting from 17.8.0, GroupDocs.Viewer provides new option CellsOptions.IgnoreEmptyRows which allows omitting rendering of empty rows as shown in the sample below.

Ignoring empty rows when rendering Cells documents.

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
  
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = "document.xlsx";
  
// Set Cells options to hide overflowing text
HtmlOptions options = new HtmlOptions();
options.CellsOptions.IgnoreEmptyRows = true; // default value is false
 
// Get pages 
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);
}

Single naming convention for HTML resources

  • Image resources (resources with extensions .png, .jpg, .jpeg, .bmp, .emf, .wmf)
    • for the first resource: image + extension e.g. image.png
    • for the second and next resources: image + number + extension e.g. image1.png
  • Font resources (resources with extensions .woff, .eot, .ttf)
    • for the first resource: font + extension e.g. font.woff
    • for the second and next resources: font + number + extension e.g. font1.woff
  • Graphics resources (resources with extensions .svg)
    • for the first resource: graphics.svg
    • for the second and next resources: graphics + number.svg e.g. graphics1.svg
  • Other resources
    • for the first resource: other + extension e.g. other.ext
    • for the second and next resources: other + number + extension e.g. other1.ext

Responsive output for rendering into HTML

In order to make your rendering into HTML look well across all type of devices set *EnableResponsiveRendering *option of HtmlOptions class and pass it to ViewerHtmlHandler as shown in example below:

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

List of document types that do not support responsive rendering

Format NameExtension
Comma-Separated ValuesCSV
Electronic publicationEPUB
Extensible Markup LanguageXML
HyperText Markup LanguageHTML, MHT, MHTML
Image filesSVG
LaTeXTEX
Microsoft ExcelXLS, XLSX, XLSM, XLSB
Microsoft PowerPointPPT, PPTX, PPS, PPSX
Microsoft ProjectMPP, MPT
Microsoft VisioVSD, VDX, VSS, VSX, VST, VTX, VSDX, VDW, VSSX, VSTX, VSDM , VSTM, VSSM
Microsoft WordDOC, DOCX, DOCM, DOT, DOTX, DOTM
Mobipocket e-book formatMOBI
OpenDocument FormatsODT, OTT, ODS, ODP, OTP, OTS
Plain Text FileTXT
Portable Document FormatPDF
Rich Text FormatRTF
XML Paper SpecificationXPS

List of Changes in v17.8.0

GroupDocs.Viewer.Config.ViewerConfig

Public bool UsePdf obsolete property compilation is set to fail

This property will be removed in the version 17.9.0, please use ImageOptions.ExtractText or DocumentInfoOptions.ExtractText settings instead, as shown in the example below.

Get text coordinates in image mode

before v17.6.0 (C#)

 //Init viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = "c:\\storage";
viewerConfig.UsePdf = true;
 
// Set document guid
string guid = "document.doc";
 
// Init viewer image handler
ViewerImageHandler viewerImageHandler = new ViewerImageHandler(viewerConfig);
 
//Get document info
DocumentInfoContainer documentInfoContainer = viewerImageHandler.GetDocumentInfo(guid);
 
// 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);
        }
    }
}

v17.6.0 and higher (C#)

//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.FileDataOptions

Public bool UsePdf obsolete property compilation is set to fail

This property will be removed in the version 17.9.0, please use ExtractText property instead.

GroupDocs.Viewer.Converter.Options.HtmlOptions

Public bool IgnoreResourcePrefixForCss property is set obsolete

This property will be removed in the version 17.11.0, please use IgnorePrefixInResources property instead, as shown in example below.

In this example HtmlResourcePrefix option will be applied to resources inside HTML content, but will not be applied inside resources like SVG and CSS.

HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.HtmlResourcePrefix = "http://contoso.com/api/getResource?name="
htmlOptions.IgnorePrefixInResources = true;
Public bool IgnorePrefixInResources has been added

Use this property to prevent adding HtmlResourcePrefix in resource files like CSS or SVG.

GroupDocs.Viewer.Domain.EmailFileData

Public GroupDocs.Viewer.Domain.EmailFileData class and class members compilation is set to fail

Please use FileData class instead. This class is obsolete and will be removed in version 17.9.0.

GroupDocs.Viewer.Handler.ViewerHtmlHandler

public ViewerHtmlHandler(ViewerConfig viewerConfig, IInputDataHandler inputDataHandler, ICacheDataHandler cacheDataHandler, IFileDataStore fileDataStore) constructor is set obsolete

This constructor is obsolete and will be removed after 17.11.0. Please use overload without ‘fileDataStore’ parameter.

public ViewerHtmlHandler(ViewerConfig viewerConfig, IInputDataHandler inputDataHandler, ICacheDataHandler cacheDataHandler, IFileDataStore fileDataStore, CultureInfo cultureInfo) constructor is set obsolete

This constructor is obsolete and will be removed after 17.11.0. Please use overload without ‘fileDataStore’ parameter.

GroupDocs.Viewer.Handler.ViewerImageHandler

public ViewerImageHandler(ViewerConfig viewerConfig, IInputDataHandler inputDataHandler, ICacheDataHandler cacheDataHandler, IFileDataStore fileDataStore) constructor is set obsolete

This constructor is obsolete and will be removed after 17.11.0. Please use overload without ‘fileDataStore’ parameter.

public ViewerImageHandler(ViewerConfig viewerConfig, IInputDataHandler inputDataHandler, ICacheDataHandler cacheDataHandler, IFileDataStore fileDataStore, CultureInfo cultureInfo) constructor is set obsolete

This constructor is obsolete and will be removed after 17.11.0. Please use overload without ‘fileDataStore’ parameter.

GroupDocs.Viewer.Helper.IFileDataStore

public interface IFileDataStore interface is set obsolete

This interface is obsolete and will be removed after 17.11.0.