Create a thumbnail of a Word document

I have a website where users upload Word documents, and I want to display thumbnails of these text documents. If any of you know how to display the first page of a Word file as an image using C #, tell me.

Also, if you know a trusted .NET library for converting word files to images that do not require office intervention, that would be great.

+6
c # ms-word thumbnails
source share
3 answers

Take a look at the article. This is in VB, but it allows you to extract the thumbnail that Windows Explorer uses for Office documents and regular images.

+7
source share

http://blogs.msdn.com/windowssdk/archive/2009/06/12/windows-api-code-pack-for-microsoft-net-framework.aspx

ShellFile shellFile = ShellFile.FromFilePath(pathToYourFile); Bitmap shellThumb = shellFile.Thumbnail.ExtraLargeBitmap; 

This Microsoft API Code Package

+2
source share

I found this question (7 years later), looking for a similar solution. I rate 2JPEG and appear to support 275 formats , including Word, Excel, Publisher, and Powerpoint files. fCoder recommends running 2JPEG as a scheduled background task. command line syntax is pretty detailed.

Here's an example snippet for sketching a specific file:

 2jpeg.exe -src "c:\files\myfile.docx" -dst "c:\files" -oper Resize size:"100 200" fmode:fit_width -options pages:"1" scansf:no overwrite:yes template:"{Title}_thumb.jpg" silent:yes 
0
source share

All Articles