[英]PDF Thumbnails on windows server 2008 R2 in asp.net
I am trying to display PDF thumbnails on asp.net website. 我正在尝试在asp.net网站上显示PDF缩略图。
When I am running the website on my local mechine from visual studio debug- the thumbnail images are displayed (tiff or pdf). 当我通过Visual Studio调试在本地机器上运行网站时,将显示缩略图(tiff或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 Server 2008 R2,ServicePack1、64位)后在服务器上运行网站时,tiff缩略图按预期显示,但PDF缩略图显示为AdobeReader图标(而不是PDF文件的第一页)。
Windows Explorer on the server displayes the PDF thumbnails correctly. 服务器上的Windows资源管理器可以正确显示PDF缩略图。
The code I write for displaying thumbnails(using WindowsAPICodePack): 我编写的用于显示缩略图的代码(使用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. 任何帮助将被申请。
I had the same problem, I used WindowsAPICodePack with asp.net too, but in the server you will need to install a pdf viewer that generates the thumbnail. 我遇到了同样的问题,我也将WindowsAPICodePack与asp.net一起使用,但是在服务器中,您将需要安装生成缩略图的pdf查看器。 If you don't have access to the server admin account forget it.
如果您无权访问服务器管理员帐户,请忘记它。
I tried first Adobe Reader XI, but it have a bug with the thumbnail preview on 64 bits https://forums.adobe.com/message/3905029 . 我首先尝试使用Adobe Reader XI,但是在64位https://forums.adobe.com/message/3905029上使用缩略图预览存在一个错误。 They suggest to apply this fix http://www.pretentiousname.com/adobe_pdf_x64_fix/index.html#downl but I want to evict some hidden hack that takes the control of my server!
他们建议应用此修复程序http://www.pretentiousname.com/adobe_pdf_x64_fix/index.html#downl,但是我想驱逐一些隐藏的黑客来控制我的服务器! So I don't install it.
所以我不安装它。
Then I installed http://www.win7pdf.com/pdf-preview.html and it worked fine. 然后,我安装了http://www.win7pdf.com/pdf-preview.html ,并且工作正常。 The thumb image quality is less than the adobe pdf one, but it's just a thumb.
拇指图像质量不如Adobe PDF,但仅仅是拇指。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.