简体   繁体   中英

How create thumbnail from doc docx in c#?

Hello I would like to create thumbnail from doc docx, actually I use library Leadtools but I have this error :

ExceptionFilter Leadtools.RasterException: Invalid file format at Leadtools.Codecs.RasterCodecs.CheckExceptions(Int32 code) at Leadtools.Codecs.RasterCodecs.DoLoad(LoadParams loadParams) at Leadtools.Codecs.RasterCodecs.Load(String fileName, Int32 width, Int32 height, Int32 bitsPerPixel, RasterSizeFlags flags, CodecsLoadByteOrder order)

I would like to use an another lib for create the thumbnail.

LeadTools is an image processing library so will fail to process non-image formats like DOCX.

The ability to read the Windows created thumbnail for other files is covered in the existing article;

C#/ASP.NET - Get thumbnail from PDF/DOC files which references the Microsoft documentation here https://msdn.microsoft.com/en-us/library/aa289172.aspx that explains how to get the image. The Microsoft doc explains how to do this in SharePoint but the example is in VB.net so should be easy to follow.

The phrase about LEADTOOLS being "an image processing library so will fail to process non-image formats like DOCX" is not entirely true. With some formats such as Word, Excel, PowerPoint and PDF files (among others), the toolkit can convert them to images but only if a Document Imaging toolkit is used. Entry-level Imaging Pro cannot load such formats. Also, if the appropriate format codec assembly is missing from the project, you will get "RasterException: Invalid file format".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM