简体   繁体   English

asp.net中Windows Server 2008 R2上的PDF缩略图

[英]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.

相关问题 通过Process写入文件夹-ASP.NET和Windows Server 2008 R2 - Writing to folder through Process - ASP.NET and Windows Server 2008 R2 30秒后在ASP.NET上超时,在SQL Server 2008 R2上没有超时 - Timeout on ASP.NET after 30 seconds, on SQL server 2008 R2 no timeout 存储过程不返回任何数据asp.net sql server 2008 r2 - store procedure don't return any data asp.net sql server 2008 r2 使用SQL Server 2008 R2在ASP.NET C#中创建Crystal Report - Creating Crystal Report in asp.net c# with SQL Server 2008 R2 部署使用Asp.Net,C#和Sql Server 2008 R2构建的Web应用程序 - Deploying an Web Application built using Asp.Net,C# and Sql Server 2008 R2 C#ASP.NET无法将联系页面上传到SQL Server 2008 R2 - C# ASP.NET trouble uploading contact page to SQL Server 2008 R2 使用SqlParameter实现C#ASP.NET和SQL Server 2008 R2的安全性 - Using SqlParameter for security with C# ASP.NET and SQL Server 2008 R2 ASP.net 收到错误“访问路径被拒绝”。 在尝试将文件上传到我的 Windows Server 2008 R2 Web 服务器时 - ASP.net Getting the error “Access to the path is denied.” while trying to upload files to my Windows Server 2008 R2 Web server Windows Server 2008 R2中未运行quartz.net作业 - quartz.net job not running in windows server 2008 R2 在Windows Server 2012 R2上运行Asp.net 5 vNext项目(MVC6)发布生成 - Run Asp.net 5 vNext project (MVC6) publish build on Windows Server 2012 R2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM