GroupDocs.Viewer for .NET 17.1.0 Release Notes

Major Features

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

  • Added possibility to configure ViewerConfig class via app.config or web.config files
  • Implemented partial rendering of large Excel sheets when rendering to Html
  • Improved rendering Email documents in Html mode
  • Improved rendering Pdf documents in Html mode

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
VIEWERNET-1043Implement setting to prevent glyphs grouping when rendering pdf documentsNew Feature
VIEWERNET-1036Partial rendering of large Excel sheets in HTML modeNew Feature
VIEWERNET-1034Implement parameterless ViewerHtmlHandler and ViewerImageHandler constructorsNew Feature
VIEWERNET-308Add possibility to configure ViewerConfig class via app.config or web.config fileNew Feature
VIEWERNET-1052Implement setting to configure content ordering in resultant HTML documentImprovement
VIEWERNET-1040Improve Email documents renderingImprovement
WEB-2422Printing Radio Buttons from HTML pageBug
WEB-1092Links are converted into plain text when converting PDF to HTMLBug
VIEWERNET-1023Merged cells in xlsx are not displayed as merged in HTMLBug
VIEWERNET-1004Alignment of radio button text and checkbox text is not properBug
VIEWERNET-994Jumbling words when rendering PDF document to HTMLBug
VIEWERNET-975Creates only one page in text(txt) documentBug
VIEWERNET-974Radio buttons are not showing as ‘selected’ or ‘checked’ when converting to fixed HTMLBug
VIEWERNET-972Radio buttons are not showing as ‘selected’ or ‘checked’Bug
VIEWERNET-581Missing characters, invalid formating when saving to HTMLBug

Public API and Backward Incompatible Changes

Implement setting to prevent glyphs grouping when rendering pdf documents

When pdf documents are rendered into html, glyphs and characters are groupped into words and string groupes, this sometimes may produce undesirable result. To prevent grouping in such situations we should set PdfOptions.PreventGlyphsGrouping value of RenderOption object to true as shown in example. This mode allows to keep maximum precision during positioning of glyphs on the page and it can be used for conversion of documents with music notes or glyphs, that should be placed separately to each other.

// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";

// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = "document.pdf";

// Set pdf options to render content without glyphs grouping
HtmlOptions options = new HtmlOptions();
options.PdfOptions.PreventGlyphsGrouping = 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);
}

Partial rendering of large Excel sheets in HTML mode

// 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 OnePagePerSheet = false to render multiple pages per sheet
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.CellsOptions.OnePagePerSheet = false;
// Set count rows to render into one page. Default value is 50.
htmlOptions.CellsOptions.CountRowsPerPage = 50;

// Get pages
List<PageHtml> pages = htmlHandler.GetPages(guid, htmlOptions);

Implement parameterless ViewerHtmlHandler and ViewerImageHandler constructors

In version 17.1.0 ViewerHtmlHandler and ViewerImageHandler objects can be initialized by parameterless constructors.

ViewerHtmlHandler handler = new ViewerHtmlHandler();

Initializing handlers this way, in combination with setting all neccesary properties for ViewerConfig in configuration file as decribed in below section, will let to reduce amount of code greatly.

Add possibility to configurate ViewerConfig class via app.config or web.config file

Public properties of ViewerConfig class, could be configurated via app.config or web.config files, depending on the type of application.

To configurate ViewerConfig class public properties you will have to follow this steps:

  1. Add
    element into inside section, with the name “groupdocs.viewer” and type “GroupDocs.Viewer.Config.GroupDocsViewerSection, GroupDocs.Viewer”.
  2. Add <groupdocs.viewer> section inside section.
  3. For each public property, which you want to be set, add an element inside <groupdocs.viewer> section, with the name equal to the property name and required value attribute.
  4. If you want to add font directory to FontDirectories collection property, create section inside <groupdocs.viewer> and append an configuration element with the required path attribute for each font directory.
  5. Initialize ViewerConfig object using parameterless constructor.

XML

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
      <section name="groupdocs.viewer" type="GroupDocs.Viewer.Config.GroupDocsViewerSection, GroupDocs.Viewer"/>
    </configSections>
    <startup>
      <supportedRuntime version="v2.0.50727"/>
    </startup>
    <groupdocs.viewer>
      <storagePath value="C:\storage"/>
      <cacheFolderName value="cachefolder"/>
      <cachePath value="C:\cache"/>
      <useCache value="true"/>
      <usePdf value="false"/>
      <localesPath value="C:\locales"/>
      <pageNamePrefix value="prefix"/>
      <defaultFontName value="Times New Roman"/>
      <fontDirectories>
        <add path="C:\fonts" />
        <add path="C:\more_fonts" />
      </fontDirectories>
    </groupdocs.viewer>
</configuration>

Implement setting to configure content ordering in resultant html document

// 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 OnePagePerSheet = false to render multiple pages per sheet
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.CellsOptions.OnePagePerSheet = false;
// Set count rows to render into one page. Default value is 50.
htmlOptions.CellsOptions.CountRowsPerPage = 50;

// Get pages
List<PageHtml> pages = htmlHandler.GetPages(guid, htmlOptions);