GroupDocs.Viewer for .NET 24.5 Release Notes

This monthly release includes three new features and 10 bug fixes.

Full list of changes in this release

KeyCategorySummary
VIEWERNET‑3417FeatureAdd support for Adobe Illustrator Encapsulated PostScript (EPS) files
VIEWERNET‑4376FeatureRender presentations as pure HTML
VIEWERNET‑4874FeatureAdd support for repairing PDF documents
VIEWERNET‑3418Fix“Could not load file. File is corrupted or damaged.” exception when rendering AI file
VIEWERNET‑4480FixThe object reference is not set to an instance of the object exception when processing certain PDF files
VIEWERNET‑4756FixInvestigate and fix issue with saving SVG to PNG
VIEWERNET‑4832FixReason for CorruptedOrDamagedFileException
VIEWERNET‑4838FixWrong page size for vector images
VIEWERNET‑4866FixUnable to View big files in Groupdocs Viewer version 20.8
VIEWERNET‑4868FixFix a bug with missing image resource which occurs only on Linux
VIEWERNET‑4872FixNull reference exception when rendering DOCX to HTML
VIEWERNET‑4826FixConverting certain PDF to HTML/PNG produces some artifacts in .NET
VIEWERNET‑4788FixConverting certain DWG to PNG is super slow in .NET

Render Adobe Illustrator Encapsulated PostScript (EPS) files

File extension: .ai.

File structure: Differs from standard AI files. EPS files typically have a %!PS-Adobe-3.0 EPSF file header, which you can see by opening the file in a text editor.

Learn more: For more information on the differences between AI and EPS formats, see the Adobe article: Comparison of AI and EPS file formats.

Render presentations as pure HTML

Before this version 24.5, the GroupDocs.Viewer for .NET was able to render presentations to the HTML in only one mode, which is heavily based on SVG images. Actually, the whole slide is converted to a single vector image in SVG format, and the HTML here is served only as a wrapper around a SVG element. This mode has an undeniable advantage of 100% accurate reproduction of the original presentation. In other words, what you see in MS PowerPoint when opening a presentation, this is exactly what you see in the web-browser after opening the same presentation in the GroupDocs.Viewer. This is possible because GroupDocs.Viewer scans the original presentation document and reproduces it by drawing every tiny element, every pixel on a SVG canvas while preserving the position, shape and orientation.

But because of its SVG-based nature this mode also has the disadvantages — the SVG markup is too complex, full-text search may not work as expected, and, actually, this is not the “real” HTML- and CSS-markup. So if you want to implement something like modification or post-processing the document after obtaining it from GroupDocs.Viewer, you may encounter troubles, because standard tools like HTML parsers or CSS queries usually are not working with SVG markup.

That’s why we represent the new HTML conversion mode for the Presentations — pure HTML/CSS mode. In this mode no SVG images are generated at all, only pure HTML and CSS markup.

By default this mode is disabled, and the existing SVG-based mode is activated. For enabling the new pure HTML/CSS conversion mode, please set the boolean flag RenderToPureHtml to true value in the PresentationOptions property of the HtmlViewOptions class.

Code example below shows converting the same presentation file to the pure HTML/CSS markup in two variations — with embedded and external resources:

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...
string inputPresentationPath = "SamplePresentation.pptx";

//preparing HTML options for embedded and external resources
HtmlViewOptions embeddedOptions = HtmlViewOptions.ForEmbeddedResources("slide_{0}_embedded.html");
HtmlViewOptions externalOptions = HtmlViewOptions.ForExternalResources("slide_{0}.html", "slide_{0}_{1}", "slide_{0}_{1}");
//enabling the pure HTML/CSS mode for both options
embeddedOptions.PresentationOptions.RenderToPureHtml = externalOptions.PresentationOptions.RenderToPureHtml = true;

using (Viewer viewer = new Viewer(inputPresentationPath))
{
    viewer.View(embeddedOptions);
    viewer.View(externalOptions);
}

Need to mention that this new pure HTML/CSS mode also has the next limitations and disadvantages:

  1. Its fidelity is generally worse compared to the original SVG-based mode, especially on presentations with complex slides layout and sophisticated text formatting.
  2. For this moment rendering comments and notes are not supported, so the RenderComments and RenderNotes properties of the HtmlViewOptions class are ignored.
  3. Resolution property of the PresentationOptions class is also not supported for this moment, the images are exported to the output HTML document in their original resolution.
  4. RenderToSinglePage boolean property of the HtmlViewOptions class is not supported too, so every slide of the presentation will be saved to the distinct HTML document.
  5. RenderResponsive boolean property of HtmlViewOptions class belongs to the existing SVG-based conversion mode, so its value is ignored while converting in pure HTML/CSS mode, — HTML- and CSS-markup are already 100% responsive.

We plan to add support for most of these missing features in the near future by constantly improving this new pure HTML/CSS converter, adding new features and fixing bugs.

Repairing corrupted PDF documents

By default GroupDocs.Viewer cannot process the PDF documents with corrupted structure or content — it throws an exception when trying to open such files. However, starting from this version 24.5 GroupDocs.Viewer can try to repair the structural corruptions in PDF documents. By default this feature is disabled. To enable it, need to use the newly added TryRepair boolean property of the LoadOptions class by setting its value to true.

When enabled, this feature addresses the following issues in a PDF document:

  • Broken references within the document (incorrect object offsets in the Cross-reference list).
  • Missing critical elements like root object, page object, or page content.
  • Circular references (Form X-object referencing itself).

Here is a source code sample:

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...

LoadOptions loadOptions = new LoadOptions();
loadOptions.TryRepair = true;

PngViewOptions viewOptions = new PngViewOptions();

using (Viewer viewer = new Viewer("resume.pdf", loadOptions))
{    
    viewer.View(viewOptions);
}