How can I create thumbnails (an image of 开发者_开发问答the first page of the document) of office documents in c#?
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!
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... "
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.
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
精彩评论