Support of Setting Output Page Size when Rendering Email Messages in GroupDocs.Viewer for .NET 18.5

Document Viewer API

We have released version 18.5 of GroupDocs.Viewer for .NET with a couple of new features as well as 12 improvements and bug fixes. The latest version includes the feature of setting output page size when rendering email messages as image and PDF. Furthermore, you can now change the field labels in the header of the email messages. The feature of rendering password protected documents has also been extended for ODT and OTT formats. Below is the list of new features, improvements, and fixes added in GroupDocs.Viewer for .NET 18.5.

.NET Document Rendering API – New Features

Setting Output Page Size when Rendering Email Messages

Since the version 18.5, it is possible to set output page size when rendering Email messages as PDF and images. To enable this feature, set the PageSize property of the EmailOptions class as shown in the following code snippet.

string guid = "long-email.msg";
   
//Instantiate Viewer Hanlder 
ViewerImageHandler imageHandler = new ViewerImageHandler();
   
//Set page size  
ImageOptions imageOptions = new ImageOptions();
imageOptions.EmailOptions.PageSize = PageSize.A4;
  
//Render document with custom page size
List pages = imageHandler.GetPages(guid, imageOptions);
  
//Use Stream property of the PageImage class, to get output image.
foreach (PageImage page in pages)
{
    Console.WriteLine(page.Stream.Length);
}

For more details on this feature, please visit this documentation article.

Changing Field Labels in Email’s Header

When rendering email messages, by default the API uses the English language to render field labels such as From, To, Subject etc.. Starting from 18.5, GroupDocs.Viewer provides a new property FieldLabels in EmailOptions class to change the field labels. Following code snippet shows how to use custom field labels.

string guid = "email.msg";

//Instantiate Viewer Hanlder 
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler();

//Set field labels 
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.EmailOptions.FieldLabels[EmailField.From] = "Sender";
htmlOptions.EmailOptions.FieldLabels[EmailField.To] = "Receiver";
htmlOptions.EmailOptions.FieldLabels[EmailField.Sent] = "Date";
htmlOptions.EmailOptions.FieldLabels[EmailField.Subject] = "Topic";
//Render document with custom field labels
List pages = htmlHandler.GetPages(guid, htmlOptions);

For more details on this feature, please visit this documentation article.

Document Viewer API for .NET – Fixes

Following issues are fixed in version 18.5 of GroupDocs.Viewer for .NET.

  • The voluminous email is not fully rendered into image
  • Images and diagrams are missing when rendering OTS file
  • Text’s shadow appears in the output HTML
  • Issues when rendering Excel document with vertical Japanese writing
  • Text overlaps when viewing HTML in Mozilla Firefox
  • Content is missing when rendering PDF document into HTML
  • Link with external URL in PDF document is not rendered as the hyperlink
  • The output image is cropped when rendering HTML as image

GroupDocs.Viewer for .NET 18.5 – Improvements

Following are the improvements that we have made in version 18.5.

  • Addition of new property EnableCaching which will replace UseCache property in ViewerConfig class
  • Support of rendering password protected ODT and OTT formats
  • Support of setting JpegQuality option when rendering OneNote documents into PDF
  • Extended support for DefaultFontName option for MS Project documents when rendering into PDF

Related Links and Resources

We have a few channels and resources for you to download, learn, try and get technical support on document viewer API.

Feedback

As always, if you have any questions or suggestions, feel free to write on our forum.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

To keep up with our news, you can follow us on Twitter or follow our Facebook page.

Comments are closed.