如何将任何文档转换为预览图像?

时间:2022-10-30 12:01:17

I am using .NET and am looking for a way to convert just about any document into a preview image. I say any, but the priorities are Office Documents, PDF, and most image files.

我正在使用.NET,我正在寻找一种方法将几乎任何文档转换为预览图像。我说任何,但优先级是Office文档,PDF和大多数图像文件。

I would assume that I can somehow build upon the Windows Explorer's ability to preview documents... but I do not know how.

我认为我可以以某种方式构建Windows资源管理器预览文档的能力......但我不知道如何。

What would you do?

你会怎么做?

1 个解决方案

#1


On Windows Vista you can use the preview handler API to either write a preview handler or use a preview handler to display a preview in your application. The link contains code that shows you how. Here's an example Photoshop preview handler that also goes over some background information that might be useful.

在Windows Vista上,您可以使用预览处理程序API编写预览处理程序或使用预览处理程序在应用程序中显示预览。该链接包含显示方式的代码。这是一个示例Photoshop预览处理程序,它还可以查看可能有用的一些背景信息。

Finally, here is an example that uses C#. It's a WPF application that uses the C# class COMStream to get the preview data from a preview handler (which is an unmanaged COM object).

最后,这是一个使用C#的示例。它是一个WPF应用程序,它使用C#类COMStream从预览处理程序(这是一个非托管COM对象)获取预览数据。

#1


On Windows Vista you can use the preview handler API to either write a preview handler or use a preview handler to display a preview in your application. The link contains code that shows you how. Here's an example Photoshop preview handler that also goes over some background information that might be useful.

在Windows Vista上,您可以使用预览处理程序API编写预览处理程序或使用预览处理程序在应用程序中显示预览。该链接包含显示方式的代码。这是一个示例Photoshop预览处理程序,它还可以查看可能有用的一些背景信息。

Finally, here is an example that uses C#. It's a WPF application that uses the C# class COMStream to get the preview data from a preview handler (which is an unmanaged COM object).

最后,这是一个使用C#的示例。它是一个WPF应用程序,它使用C#类COMStream从预览处理程序(这是一个非托管COM对象)获取预览数据。