locked
PDF Thumbnails on server in asp.net RRS feed

  • Question

  • User-1266529696 posted

    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!!!

    Monday, May 26, 2014 3:46 AM

All replies

  • User753101303 posted

    Hi,

    "Windows Explorer on the server" Do you mean showing the server disk from your client computer or do you mean using "Windows Explorer inside a server side session" ?

    My first thought would be that you don't have an Adobe Reader on your server. To me the method you are using does use products that are registered as being able to generate thumbnails for this file format so if it is not installed on the server, it won't be able to generate thumbnails.

     

    Monday, May 26, 2014 8:08 AM
  • User-1266529696 posted

    Thanks a lot for your reply.

    Windows Explorer On The Server I mean - when I connect to the server by remote desktop from my computer,  I can see the files thumbnails in the folders.

    Adobe Reader XI has already been installed on the server.- (and the thumbnails are shown there..)

    What can be the solution?

    Monday, May 26, 2014 9:22 AM
  • User-1266529696 posted

    I am still looking for a solution , didn't find one yet.

    Maybe someone knows , instead of the code above-

    How can I save the first page of pdf file as small image?

    I found some solutions but none of them worked for me because I need c# code that works on Windows Server 2008 R2

    Wednesday, May 28, 2014 1:52 AM