Rendering a word doc as an image in a .net web application

I am trying to display a word docx in a web page as an image. I’ve had a look at you online demo and it seems to do exactly what I need , as i’m a novice at .asp.net I could do with some help.

You don’t seem to be attaching the the document in anyway to the img. I think you are using a ashx file but the ashx file/code is not included in the online demo.

<td bgColor="#aaccff" align="center"><img alt="Document page" src="DocumentPageHandler.ashx"/></td>

how does the ashx file get the image data from the document object?

do you have any instructions on how to do this?

Thanks

Gary Vernon

Hi Gary,

Thanks for your inquiry. You can find the required code in attached “DocumentPageHandler.zip” archive. Moreover, if you want a web application to serve images in a variety of sizes, you can write a custom handler to resize images and then send them to the user as the handler’s response. Please read the following article for more details:
https://docs.microsoft.com/en-us/previous-versions/aspnet/bb398986(v=vs.100)

Best regards,