ViewerImageHandler Culture Question

We are currently on version 18.9.0.0 of GroupDocs.Viewer for .NET.

We are using public ViewerImageHandler(ViewerConfig viewerConfig, CultureInfo cultureInfo); from the GroupDocs.Viewer.Handler namespace where we want to pass in the user’s Culture (i.e. if they’re from the UK for example, en-GB) so that when we use public FileContainer GetPdfFile(Stream fileStream, string fileName, PdfFileOptions pdfFileOptions); we can get the file converter to a PDF and with any dates formatted in the given culture. For example, if we have an xlsx file with a cell that is formatted based off of the user’s computer settings, we’d want that date to be formatted correctly when we get the converted PDF filestream for the original xlsx file. This wanted functionality doesn’t seem to be working, we noticed that there is a comment saying “The viewer culture. Supported cultures are en-Us, pt-PT and ru-RU.” Does this mean we can pass cultures from other regions and to fit formats associated with said regions? We also have noticed that the latest version of GroupDocs.Viewer has ViewerImageHandler on the path to deprecation, is there a new service we should use to get the desired functionality we want which is 1) Converting files into PDF streams for previewing purposes and 2) Having files converted and rendered correctly by taking in user Culture information for things such as date formats.

Thanks for any help!

@bdrake,

I am afraid that the mentioned feature doesn’t work in the way you are expecting. The CultureInfo that you are using in ViewerImageHandler(ViewerConfig viewerConfig, CultureInfo cultureInfo) was introduced only for the exception messages such as:

  • Could not load file ‘<< file name>>’, file is corrupted or damaged.
  • File type ‘<< file type>>’ is not supported.
  • and so on.

It doesn’t work for the content inside the document that is being rendered. Furthermore, this feature is now obsolete and has been removed since v19.4.

Yes, since v19.8. we have revamped the architecture of the API to incorporate major product optimization and improvements. Now, the Viewer class is introduced as a single entry point to manage the document rendering process for any supported file format (instead of ViewerHtmlHander and ViewerImageHander classes). For more details on it, please have a look at the migration notes.

We have logged it in our internal Issue Tracking System (ID: VIEWERNET-2152) to check if it is feasible to implement your requested feature. We shall get back to you in case we have any updates for you.

@bdrake,

In order to proceed with your requested feature, we need your further assistance. Please provide us some sample documents, for example, an XLSX file with a cell that is formatted based on a particular culture.

Sorry for the slow reply - here’s a file.

-Brett

TestUKDateFormat.zip (6.7 KB)

@bdrake,

Thanks for sharing the sample file.

@bdrake,

We have got an update for you regarding the ticket VIEWERNET-2152. GroupDocs.Viewer for .NET currently supports changing the date format for the given culture info. When rendering spreadsheets, the current thread’s culture Thread.CurrentThread.CurrentCulture is picked up and used. For reference, you can download the sample application and the resultant output we get for different cultures:

Please let us know if the proposed solution suits your requirements.