2

How can I create thumbnails (an image of the first page of the document) of office documents in c#?

Alexis Pigeon
  • 7,423
  • 11
  • 39
  • 44
Luis
  • 2,665
  • 8
  • 44
  • 70

4 Answers4

3

Not sure if this helps but there's possibly a thread of information you can follow here..

See C# get thumbnail from file via windows api

Hope this helps!

Community
  • 1
  • 1
Julian Young
  • 872
  • 2
  • 9
  • 21
0

This answer should work for .doc and .docx files, at least:

https://stackoverflow.com/a/73445698/4783290

From the developer's page:

"The featured function, conversion allows converting Word documents (Word 97-2003, Word 2007, Word 2010, Word 2013, Word 2016 and Word 2019) to commonly used file format, such as XML, RTF, TXT, PDF, XPS, EPUB, HTML and Image etc. Friendly Reminder: Free version is limited to 500 paragraphs and 25 tables... "

renzol
  • 183
  • 2
  • 8
-1

2JPEG is a great solution for generating thumbnails. However, this only works in Microsoft Office files if you have Office installed in your computer. It will not work in a server.

Ivan Krsul
  • 51
  • 6
-2

I'm evaluating 2JPEG and it appears to support 275 formats including Word, Excel, Publisher & Powerpoint files. fCoder recommends running 2JPEG as a scheduled background task. The command line syntax is pretty comprehensive.

Here's a sample snippet to generate a thumbnail for 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
James Moberg
  • 4,360
  • 1
  • 22
  • 21