How to configure the asp.net_MVC_Front_End to display document in image only?

I think we don’t need to display documents in html form.

what is the reason for showing both html and image for each document in your MVC_Front_End sample ? I will check the code to see if I can only show the image part.
Please let me know if you have the answer for this question.

Thanks!

Hi Yuan,


Thanks for posting your question here.

The reason behind showing both HTML view and image view of each document in ASP.NET MVC Front End is to demonstrate how the document will be displayed using the image based rendering and HTML based rendering. Now, its up to the user that which way is the most suitable for him. If you want to use image based viewer and remove the HTML based viewer then it is as simple as ABC. You can simply remove the element viewerHtmlDiv from HTML tags and its JavaScript function in index.cshtml file.

For your convenience, I have also attached a sample index.cshtml file which contains only image based viewer. You can simply replace your index.cshtml file with this one.

Hope it helps.

Warm Regards

Thank you for teaching me how to do image view only.

I know we have not purchased a license and I am still using a temp license.
But I keep getting an error message and could not see anything rendered on the screen. That is “unlicense version of Groupdocs.viewer for .net allows 15 viewers per hour”. Is it possible to get rid of it?
Anyway, I used your index.cshtml and successfully displayed a document in image only. Thank you for your help. (I am also going to test each type of document being used by our customers.)
However I got an error when I was showing demo.docx in html view for curious purpose.
It stopped or crashed at line #2569 in GroupdocsViewer.all.js
I think this is due to that response.pageHtml is null and it is not able to get its value of response.pageHtml[0]. Attached here is the index.cshtml file for you to check. Please change the name back to index.cshtml when testing.

Hi Yuan,


Its good to know that you are now able to view documents in image mode only.

The issues you mentioned in the above post are because of using the API in trial mode. To apply the license you will have to provide the path of temporary license file in line# 9 of ASP.NET_MVC_Front_End/Global.asax.cs file (see this). This will surely solve your problem.

In case you get any further issue, please do let us know.

Warm Regards

I got an error when I was showing demo.docx in html view ONLY for curious purpose.

For this I attached the index.cshtml file in the previous post. I followed your idea to create this html only index file.



It stopped or crashed at line #2569 in GroupdocsViewer.all.js



Please check this for us.

Hi Yuan,


Thanks for coming back to us.

When using the API in trial mode, after 15 views trial limit exceeds and the API posts a null value in response.pageHtml[0]. This is the reason behind getting exception at this point. When you will apply the license the way I mentioned in the previous post (15911) then you will get rid of this issue.

Happy Coding.
Warm Regards

Here is the issue I am talking about.

I got an error when I was showing your demo.docx in HTML view only.

It got an exception error at line #2569 in GroupdocsViewer.all.js
I think this is due to that response.pageHtml is null and it is not able to get its value of response.pageHtml[0]. Attached here is the index.cshtml file for you to check. Please change the name back to index.cshtml when testing.
This index file is used to show HTML view only!

Hi Yuan,


We have tested your provided index.cshtml file at our end and there is noting wrong with it. As I mentioned in the previous post, the issue will be resolved when using the API is licensed mode (applying temporary license in your case).

If you still have any confusion, please let us know.

Warm Regards