Document viewer API for .NET - Corrupted or damaged file exception

get this exception while reading the file from the local path.
I can able to get the list of files in the folder, but when i am trying to get list of PageHtml from a single file i am getting this error. can you please help me on this.

@gwkravi,

Thanks for contacting support.

Please share with us the following details so that we can investigate your reported issue at our end.

  • Platform (.NET or Java) and version of GroupDocs.Viewer you are using
  • Problematic document for which you are getting the exception
  • Complete source code that you are using to get HTML representation of the document

We shall be looking forward to hearing from you.

Hi Usman,
below are the details

  1. we are using Visual Studio 2017 & GroupDocs.Viewer Ver 19.2.0
  2. A simple word document (https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/blob/master/Examples/Data/Storage/word.doc)
  3. Code : // Set viewer configuration
    ViewerConfig config = new ViewerConfig();
    config.StoragePath = @“E:\storage”;
    // Initailize ViewerHandler
    ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
    var files = htmlHandler.GetFileList();
    // Get Html pages
    List pages = htmlHandler.GetPages(files.Files[0].Guid);
    //List pages = htmlHandler.GetPages(“word.doc”);

@gwkravi,

Thanks for your response.

We are unable to reproduce your reported issue using your provided details. Would you please share with us a standalone sample application (source code without compilation errors) that can be used to reproduce the issue at our end?

Hi Usman,
I am uploading the application, Please look into the issue.GroupDocs.Viewer.WebApp.zip (1.0 MB)

@gwkravi,

Thanks for your response.

We have tested your provided web application and managed to reproduce the issue at our end. We have logged this issue in our Issue Tracking System as VIEWERNET-1903 for further investigation. We shall keep you notified in case of any updates.

@gwkravi,

We have got the updates regarding your reported issue.

The web application you have shared with us is targeting .NET Core Framework and at the moment, GroupDocs.Viewer for .NET is not available for .NET Core. The application can be built successfully but it is expected that it will throw exceptions at run-time as .NET Core does not provide the API which GroupDocs.Viewer relies on for rendering documents. Your application can be run successfully in case it targets .NET Framework. For reference, please download this application.

Thank you usman, are you planning to release an SDK which support .NET Core? Please share details

@gwkravi,

We have it in our roadmap to provide the support of .NET Core (logged as VIEWERNET-1904), however, I am afraid that we can not provide any ETA at the moment. We shall keep you informed as soon as we have any updates for you.

Hi Usman,

I have a issue with Groupdocs.Viewer, I have an SDK installed in WebAPI and i am able to get the HTML content of the file. The issue is, if i need options to download, export etc to hookup to UI(reactJs) is this possible? Please share details with example.

@gwkravi,

Would you please share whether you are using GroupDocs.Viewer’s Cloud SDK or the standalone GroupDocs.Viewer for .NET API?

Please provide some more details regarding your scenario. Do you want to implement the functionality to download the original document that is being rendered?

Hi Usman,

Let me brief you my requirement and then you can suggest with the options you have.

Description : The UI is ReactJS and the backend sevices is WebApi
My requirement is the user can upload his documents to Azure File Storage and he can check his documents by viewing the list of documents in thumbnails and if he clicks on ny thumbnail he can view and if he needs to download the document there must be an option to download the document.

All this GET list of document and POST upload the document to azure file storage will be taken care by the WebAPI.
Is GroupDocs.Viewer SDK helps us to get viewer as html string from the API to display on the ReactJs UI.

If yes please share details. or can you suggest how Groupdocs.viewer works in this scenario.

@gwkravi,

Thanks for sharing the details. GroupDocs.Viewer provides the feature of integrating third-party cloud storage (i.e. Azure, Amazon S3) to render the documents in your application. Once you have configured the cloud storage with GroupDocs.Viewer, the API itself fetches the document from the storage and renders into HTML pages or images. You can then display the rendered content in your front end UI.

Furthermore, you can use GetFile method to get the original document and it may help you integrating the downloading feature in your application. In case you have configured the third-party cloud storage, GetFile method will fetch the document from the storage and provide you with the file’s stream. For sample code of integrating third-party storages, please visit this documentation article. The complete working examples are available at the GitHub repository.

Thank you Usman,

One more question, I have implemented the same as above sent example, Do this GroupDocs.Viewer SDK returns the whole document with layout i.e., the whole outline window with download, upload & thumbnail view options as screenshot below
image.png (102.5 KB)

@gwkravi,

GroupDocs.Viewer is only a back-end API and it doesn’t contain any built-in UI control/layout. You will have to create your own front end layout to display the rendered document as well as the controls such as download, upload, etc. Furthermore, you may also try our open source document viewer applications hosted on GitHub repository.

The support of .NET Standard 2.0 (filed as VIEWERNET-1904) has been added in this update. This message was posted using Bugs notification tool by usman.aziz