PDF asp.net上服务器上的缩略图 [英] PDF Thumbnails on server in asp.net

查看:127
本文介绍了PDF asp.net上服务器上的缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在asp.net网站上显示PDF缩略图。



当我在本地机器上从visual studio调试运行网站时 - 缩略图显示(tiff或pdf)。



当我在发布它后在服务器上运行该站点(Windows Server 2008 R2,ServicePack1,64bit)时 - tiff缩略图是按预期显示,但PDF缩略图显示为AdobeReader图标(不是PDF文件的第一页)。



服务器上的Windows资源管理器正确显示PDF缩略图。



我为显示缩略图而编写的代码(使用WindowsAPICodePack):



 使用(ShellFile shellFile = ShellFile.FromFilePath(curPath))
{
using (Bitmap shellThumb = shellFile.Thumbnail.MediumBitmap)
{
using (MemoryStream ms = new MemoryStream())
{
shellThumb.Save(ms,ImageFormat.Gif);
var base64Data = Convert.ToBase64String(ms.ToArray());
imgFile.Attributes.Add( src data:image / gif; base64, + base64Data);
imgFile.Visible = true ;
}
}
}



任何帮助都会被appriciated !!!

解决方案

I am trying to display PDF thumbnails on asp.net website.

When I am running the website on my local mechine from visual studio debug- the thumbnail images are displayed (tiff or pdf).

When I run the site on the server after publishing it (Windows Server 2008 R2, ServicePack1, 64bit) - the tiff thumbnails are displayed as expected, but PDF thumbnails displayed as AdobeReader icons (not the first page of the PDF file).

Windows Explorer on the server displayes the PDF thumbnails correctly.

The code I write for displaying thumbnails(using WindowsAPICodePack):

using (ShellFile shellFile = ShellFile.FromFilePath(curPath))
 {
     using (Bitmap shellThumb = shellFile.Thumbnail.MediumBitmap)
     {
          using (MemoryStream ms = new MemoryStream())
          {
              shellThumb.Save(ms, ImageFormat.Gif);
              var base64Data = Convert.ToBase64String(ms.ToArray());
              imgFile.Attributes.Add("src", "data:image/gif;base64," + base64Data);
              imgFile.Visible = true;
          }
     }
 }


Any help would be appriciated!!!

解决方案

这篇关于PDF asp.net上服务器上的缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆