Free Support Forum -

RAR to PNG conversion in Csharp

While converting this RAR file to PNG, we are getting a “The RAR5 format is not yet supported by Aspose.ZIP for .NET 20.6” exception in GroupDocs viewer version 20.11.0 -

System.NotImplementedException: The RAR5 format is not yet supported by Aspose.ZIP for .NET 20.6.
   at   .()
   at Aspose.Zip.UnRAR.RarArchive.(Int64 )
   at Aspose.Zip.UnRAR.RarArchive.(   , Int64 )
   at Aspose.Zip.UnRAR.RarArchive..ctor(Stream sourceStream)
   at   .(Stream )
   at   ..ctor(Stream , String , String , String )
   at   .(String )
   at  .(Object )
   at  .(Object )
   at  .(MethodBase , Boolean )
   at  . (  ,   )
   at  . ()
   at  .(Boolean )
   at  .(Object )
   at  .(Object )
   at  .()
   at  .(Object , UInt32 )
   at  .(Boolean )
   at  .(Object[] , Type[] , Type[] , Object[] )
   at  .(Stream , String , Object[] , Type[] , Type[] , Object[] )
   at  .(Stream , String , Object[] )
   at  .(Stream , String , Object[] )
   at   .     ​ (LoadOptions , BaseViewOptions )
   at   .     ​(String , Stream , LoadOptions , BaseViewOptions )
   at GroupDocs.Viewer.Viewer.(LoadOptions , BaseViewOptions )
   at GroupDocs.Viewer.Viewer.(BaseViewOptions )
   at GroupDocs.Viewer.Viewer.(ViewInfoOptions )
   at GroupDocs.Viewer.Viewer..()
   at   .[TEntry](ICache , String , Func`1 )
   at GroupDocs.Viewer.Viewer.GetViewInfo(ViewInfoOptions options)

Our code relies upon the FileType.GetSupportedFileTypes API to show the supported file types to the end user. RAR is one of the supported file types returned by this API. Therefore, we would request you to look into this conversion and either

  • Fix the exception and convert the file successfully, or

  • Don’t return RAR in the list from the GetSupportedFileTypes API

1 Like


We couldn’t reproduce this issue at our end using API version 20.11. Have a look at this output.png (3.6 KB). Please share following details and we’ll look into this scenario:

  • API version that you are using
  • Sample code to reproduce this issue

Hi @Atir_Tahir,
We are using GroupDocs Viewer version 2.11.0. We have used the ThreadSafeFileCache from this example code, and the other bits from this example in GitHub.

        string outputDir = Path.Combine(Utility.GroupDocsOutputPath, data.DocumentId);
        string cacheDir = Path.Combine(outputDir, "cache");
        IKeyLockerStore keyLockerStore = new ConcurrentDictionaryKeyLockerStore(_keyLocker, cacheDir);
        ICache threadSafeCache = new ThreadSafeFileCache(new FileCache(cacheDir), keyLockerStore);
        var settings = new ViewerSettings(threadSafeCache);
        string pageFilePathFormat = Path.Combine(outputDir, "page{0}.png");

        using var viewer = new Viewer(filePath, settings);

        // We are getting the exception in the next line of code

        ViewInfo vi = viewer.GetViewInfo(ViewInfoOptions.ForPngView(false));

        var options = new PngViewOptions(pageFilePathFormat);
        viewer.View(options, Enumerable.Range(1, Math.Min(vi.Pages.Count, numberOfPages)).ToArray());
1 Like


We still can’t reproduce this issue using the following code:

string cacheFolder = @"D:/cache";
string cachePath = Path.Combine("cache", cacheFolder);
string uniqueKeyPrefix = cachePath;
ICache fileCache = new FileCache(cachePath);
IKeyLockerStore keyLockerStore = new ConcurrentDictionaryKeyLockerStore(KeyLockerMap, uniqueKeyPrefix);
ICache threadSafeCache = new ThreadSafeCache(fileCache, keyLockerStore);
ViewerSettings viewerSettings = new ViewerSettings(threadSafeCache);
string pageFilePathFormat = Path.Combine(@"D:/", "page_{0}.png");
using (Viewer viewer = new Viewer(@"D:/Chess.rar", viewerSettings))
    ViewInfo vi = viewer.GetViewInfo(ViewInfoOptions.ForPngView(false));
    PngViewOptions options = new PngViewOptions(pageFilePathFormat); 

Could you please share a simple console application using that issue could be reproduced?

Hi @Atir_Tahir,
Weirdly it has started working for us as well. I’m confused since nothing has changed and yet the error seems to have fixed itself :thinking:

Anyway, just for information we are running the application in a microsoft/windowsservercore:ltsc2016 container.


1 Like


Good to know that this exception is fixed. Do let us know if you further face any issue.