Free Support Forum - groupdocs.com

How to load the converted document in html viewer

Hi Team,
we are started using v21.3 Total.
Downloaded the ASP.NET Webform code from github.
Trying to test the Viewer, that should show document along with viewer (as per demo)
I’m able to convert the pdf & docx files in output folder with html file.
How to show this in the viewer similar as demo.
Please help.

Hi @venkatmallu,

Please check the attached animation of the Viewer demo where I’m opening a file to view.
To show a file the following steps are performed in the background:

  • When you select a file it is being loaded into memory
  • Viewer converts file to HTML - one HTML file per page
  • The HTML files from the previous step are displayed

So, you don’t need to convert PDF & DOCX files by yourself to view them.
Please let us know if you are trying to do something else and we’ll try to assist you.

Have a nice day!

Our use case is, the documents available in one location should be displayed in Viewer.

I’m tying below logic in viewer.aspx.cs --> page_load
we are getting blanck screen, not showing the viewer also.

  string inputFile = AppDomain.CurrentDomain.BaseDirectory + @"InputFiles\test_docx.docx";
  string outputFile = AppDomain.CurrentDomain.BaseDirectory + @"OutputFiles\p1age_{0}.html";
using (GroupDocs.Viewer.Viewer viewer = new GroupDocs.Viewer.Viewer(inputFile))
        {                
            HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(outputFile);
            viewer.View(options);             
        }

@venkatmallu

The Viewer.aspx.cs is just code-behind for Viewer.aspx page that contains links to scripts that are client-side Angular application that is used to view HTML files created by Viewer.

All the main logic is located in ViewerApiController.cs, HtmlViewer.cs and PngViewer.cs classes where the last two is actually a converters to HTML and PNG accordingly.

I’m tying below logic in viewer.aspx.cs --> page_load

The posted code in the Viewer.aspx.cs file it will just convert “test_docx.docx” to HTML. In case you just need to convert DOCX to HTML please check the sample_viewer_app.zip (22.3 KB) that is using similar code.

Having below lines in Viewer.aspx
I’m looking for showing the document in Viewer using ASP.NET WebForm sample application.
Similarly what you have given in animation

    
<script src="/resources/angular/viewer/polyfills-es5.js" nomodule></script>
<script src="/resources/angular/viewer/runtime-es2015.js" type="module"></script>
<script src="/resources/angular/viewer/runtime-es5.js" nomodule></script>
<script src="/resources/angular/viewer/styles-es2015.js" type="module"></script>
<script src="/resources/angular/viewer/styles-es5.js" nomodule></script>
<script src="/resources/angular/viewer/vendor-es2015.js" type="module"></script>
<script src="/resources/angular/viewer/vendor-es5.js" nomodule></script>
<script src="/resources/angular/viewer/main-es2015.js" type="module"></script>
<script src="/resources/angular/viewer/main-es5.js" nomodule></script>
<script src="/resources/angular/viewer/styles-es2015.js" type="module"></script>
<script src="/resources/angular/viewer/styles-es5.js" nomodule></script>

@venkatmallu

What you need is just to run the GroupDocs.Total-for-NET-WebForms using Visual Studio. On the first build, all the dependencies will be loaded so it may take some time. You can also try running GroupDocs.Viewer-for-.NET-WebForms that would build faster.

After you build and run the application you should see that http://localhost:8080/ is automatically opened in a browser.

Could you please confirm that the application is built without errors and http://localhost:8080/ can be opened in a browser?

Thanks