Generate a thumbnail of a Word document

后端 未结 3 1831
感动是毒
感动是毒 2021-02-09 05:46

I have a website where users upload Word documents and I want to display thumbnails of these word documents. If anyone of you knows how to display the first page of a Word file

相关标签:
3条回答
  • 2021-02-09 06:08

    I found this question (7 yrs later) while searching for a similar solution. 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
    
    0 讨论(0)
  • 2021-02-09 06:24

    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;
    

    It's Microsoft's API Code Pack

    0 讨论(0)
  • 2021-02-09 06:26

    Take a look at this article. It's in VB, but it lets you extract the thumbnail image that Windows Explorer uses for Office documents and regular images.

    0 讨论(0)
提交回复
热议问题