GroupDocs.Viewer For .NET 3.2.0 Release Notes

Major Features

There are 36 improvements and fixes in this regular monthly release. The most notable are:

  • File detection from stream.
  • Introduced PdfFileOptions.
  • Introduced new conversion mechanism for multipage TIFF documents.
  • Introduced options to show/hide grid lines for excel documents.
  • Introduced jpeg image quality settings.
  • Introduced file description property which returns document type format.
  • Introduced method that returns supported document formats.
  • Introduced option that allows to set text document encoding.
  • Introduced Hide/Show the hidden sheets for Excel files option.
  • Custom localization engine to use custom locales from path.
  • Improved document processing fidelity and speed.
  • Improved quality of re-sized images.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
WEB-2128New conversion mechanism for displaying multipage TIFF filesNew Feature
VIEWERNET-542Implement option that allows to set text document encoding.New Feature
VIEWERNET-495Implement method that returns supported document formats.New Feature
VIEWERNET-494Implement file description property that returns document type format.New Feature
VIEWERNET-484Provide jpeg image quality setting.New Feature
VIEWERNET-469Implement configuration option that allows set cells sheet conversion mode when converting to pdf.New Feature
VIEWERNET-434Add support for Portuguese localeNew Feature
VIEWERNET-415Add ability to show/hide grid lines for excel filesNew Feature
VIEWERNET-393New conversion mechanism for displaying multipage TIFF filesNew Feature
VIEWERNET-389Implement PdfFileOptions same as another Options classes.New Feature
VIEWERNET-304Process files from stream without specifying fileName parameterNew Feature
VIEWERNET-525Implement storing cache files separately depends on use pdf option.Improvement
VIEWERNET-515Improve quality of re-sized images.Improvement
VIEWERNET-462Improve document processing fidelity and speedImprovement
VIEWERNET-436User provided Excel Spreadsheet does not follow MS Excel behavior when rendered to PDFImprovement
VIEWERNET-423Improve localization engine to use custom locales from pathImprovement
VIEWERNET-395Hide/Show the hidden sheets for Excel filesImprovement
WEB-2446DocuSign signed files not showing all contentBug
WEB-2445Doc to Pdf save errorBug
WEB-2441Empty htmlBug
WEB-2438Not all content of the pdf document rendered to htmlBug
WEB-2435High memory usage while converting to PdfBug
WEB-2402Specific eml file can’t be viewed in HTML modeBug
VIEWERNET-528Failed to rotate page if page number specified.Bug
VIEWERNET-514Resolution is set incorrectly when converting pdf to image.Bug
VIEWERNET-513Image re-sized incorrectly when re-sizing to larger dimensions.Bug
VIEWERNET-493Css classes are overridden in multiple pages documentsBug
VIEWERNET-486Shift_JIS encoded characters are not showing in proper formatBug
VIEWERNET-480PreloadPagesCount is not working in V3.0Bug
VIEWERNET-479Blurry document in Image Based renderingBug
VIEWERNET-472Invalid Parameter Exception on rendering PDF to HTMLBug
VIEWERNET-455Underline for some words/sentences when saving to html/imageBug
VIEWERNET-454Failed to convert .xlsx with fixed headers table to image.Bug
VIEWERNET-453Conversion of .xlsx with fixed headers table to pdf never completes.Bug
VIEWERNET-451Empty Value Exception on rendering PDF FileBug
VIEWERNET-438Invalid Parameter Exception on rendering Excel Spreadsheet to HTMLBug
VIEWERNET-508MinimumImageWidth is not working in V3.0Bug
VIEWERNET-509Quality is not working in V3.0Bug
VIEWERNET-511Locale is not working in V3.0Bug

Public API and Backward Incompatible Changes

How to show grid lines for Excel files

Show grid lines for Excel files in image representation

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

// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
string guid = "document.xlsx";

// Set image options to show grid lines
ImageOptions options = new ImageOptions();
options.CellsOptions.ShowGridLines = true;

List<PageImage> pages = imageHandler.GetPages(guid, options);

foreach (PageImage page in pages)
{
     Console.WriteLine("Page number: {0}", page.PageNumber);

     // Page image stream
     Stream imageContent = page.Stream;
}
 

Show grid lines for Excel files in html representation

// 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 html options to show grid lines
HtmlOptions options = new HtmlOptions();
options.CellsOptions.ShowGridLines = 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);
}
 

How to deny showing multiple pages per sheet for Excel files

Multiple pages per sheet

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

// Create image or html handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
string guid = "document.xlsx";

// Set pdf file one page per sheet option to false, default value of this option is true
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.Guid = guid;
pdfFileOptions.CellsOptions.OnePagePerSheet = false;

//Get pdf file
FileContainer fileContainer = imageHandler.GetPdfFile(pdfFileOptions);

//The pdf file stream
Stream pdfStream = fileContainer.Stream;
 

How to get all supported formats

Get all supported document formats

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

// Create image or html handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);

// Get supported document formats
DocumentFormatsContainer documentFormatsContainer = imageHandler.GetSupportedDocumentFormats();
Dictionary<string, string> supportedDocumentFormats = documentFormatsContainer.SupportedDocumentFormats;

foreach (KeyValuePair<string, string> supportedDocumentFormat in supportedDocumentFormats)
{
    Console.WriteLine(string.Format("Extension: '{0}'; Document format: '{1}'", supportedDocumentFormat.Key, supportedDocumentFormat.Value));
}
 

Show hidden sheets for Excel files

Show hidden sheets for Excel files in image representation

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

// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
string guid = "document.xlsx";

// Set image options to show grid lines
ImageOptions options = new ImageOptions();
options.CellsOptions.ShowHiddenSheets = true;

DocumentInfoContainer container = imageHandler.GetDocumentInfo(new DocumentInfoOptions(guid));

foreach (PageData page in container.Pages)
    Console.WriteLine("Page number: {0}, Page Name: {1}, IsVisible: {2}", page.Number, page.Name, page.IsVisible);

List<PageImage> pages = imageHandler.GetPages(guid, options);

foreach (PageImage page in pages)
{
    Console.WriteLine("Page number: {0}", page.PageNumber);

    // Page image stream
    Stream imageContent = page.Stream;
}
 

Show hidden sheets for Excel files in image representation

// 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 html options to show grid lines
HtmlOptions options = new HtmlOptions();
options.CellsOptions.ShowHiddenSheets = true;

DocumentInfoContainer container = htmlHandler.GetDocumentInfo(new DocumentInfoOptions(guid));

foreach (PageData page in container.Pages)
    Console.WriteLine("Page number: {0}, Page Name: {1}, IsVisible: {2}", page.Number, page.Name, page.IsVisible);

List<PageHtml> pages = htmlHandler.GetPages(guid, options);

foreach (PageHtml page in pages)
    Console.WriteLine("Page number: {0}", page.PageNumber);
 

Localization

How to create and use file with localized strings

1. Create xml file with localized strings

XML

<?xml version="1.0" encoding="utf-8" ?>
<root>
  <data name="EXC_TMPL_CORRUPTED_OR_DAMAGED_FILE">
    <value>Could not load file '{0}', file is corrupted or damaged.</value>
  </data>
  <data name="EXC_TMPL_FILE_TYPE_NOT_SUPPORTED">
    <value>File type '{0}' is not supported.</value>
  </data>
  <data name="EXC_TMPL_INVALID_PASSWORD">
    <value>Unable to decrypt file '{0}'. Password is invalid.</value>
  </data>
  <data name="EXC_TMPL_PASSWORD_PROTECTED_FILE">
    <value>Unable to open encrypted file '{0}'. Please provide password.</value>
  </data>
  <data name="EXC_TMPL_STORAGE_PATH_NOT_SPECIFIED">
    <value>The storage path is not specified. Please provide storage path.</value>
  </data>
  <data name="EXC_TMPL_CACHE_FILE_NOT_FOUND">
    <value>Could not find cached file '{0}'.</value>
  </data>
  <data name="EXC_TMPL_GUID_NOT_SPECIFIED">
    <value>The file GUID is not specified. Please provide file GUID.</value>
  </data>
  <data name="EXC_TMPL_TRANSFORMATION_FAILED_PAGE_NOT_EXIST">
    <value>Unable to transform file '{0}'. Page number '{1}' does not exist.</value>
  </data>
</root>
 

2. Save file to disc e.g. “c:
locales
" with following name “LocalizedStrings-Language Culture Name.xml” where Language Culture Name is your culture name e.g. “fr-FR”. So path is “c:
locales
LocalizedStrings-fr-FR.xml”

3. Setup ViewerConfig to use file with localized strings created above

// Setup viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = @"c:\\storage";
viewerConfig.LocalesPath = @"c:\\locales";

// Create html handler
CultureInfo cultureInfo = new CultureInfo("fr-FR");
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(viewerConfig, cultureInfo);
 

How to set Words, Cells and Email document encoding

How to set Words, Cells and Email document encoding

//Initialize viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = "c:\\storage";

//Initialize viewer handler
ViewerImageHandler viewerImageHandler = new ViewerImageHandler(viewerConfig);

//Set encoding
Encoding encoding = Encoding.GetEncoding("shift-jis");

//Set image options
ImageOptions imageOptions = new ImageOptions();
imageOptions.WordsOptions.Encoding = encoding;
imageOptions.CellsOptions.Encoding = encoding;
imageOptions.EmailOptions.Encoding = encoding;

//Get words document pages with encoding
string wordsDocumentGuid = "document.txt";
List<PageImage> wordsDocumentPages = viewerImageHandler.GetPages(wordsDocumentGuid, imageOptions);

//Get cells document pages with encoding
string cellsDocumentGuid = "document.csv";
List<PageImage> cellsDocumentPages = viewerImageHandler.GetPages(cellsDocumentGuid, imageOptions);

//Get email document pages with encoding
string emailDocumentGuid = "document.msg";
List<PageImage> emailDocumentPages = viewerImageHandler.GetPages(emailDocumentGuid, imageOptions);

//Get words document info with encoding
DocumentInfoOptions wordsDocumentInfoOptions = new DocumentInfoOptions(wordsDocumentGuid);
wordsDocumentInfoOptions.WordsDocumentInfoOptions.Encoding = encoding;
DocumentInfoContainer wordsDocumentInfoContainer = viewerImageHandler.GetDocumentInfo(wordsDocumentInfoOptions);

//Get cells document info with encoding
DocumentInfoOptions cellsDocumentInfoOptions = new DocumentInfoOptions(cellsDocumentGuid);
cellsDocumentInfoOptions.CellsDocumentInfoOptions.Encoding = encoding;
DocumentInfoContainer cellsDocumentInfoContainer = viewerImageHandler.GetDocumentInfo(cellsDocumentInfoOptions);

//Get email document info with encoding
DocumentInfoOptions emailDocumentInfoOptions = new DocumentInfoOptions(emailDocumentGuid);
emailDocumentInfoOptions.EmailDocumentInfoOptions.Encoding = encoding;
DocumentInfoContainer emailDocumentInfoContainer = viewerImageHandler.GetDocumentInfo(emailDocumentInfoOptions);
 

© Aspose Pty Ltd 2001-2022. All Rights Reserved.