Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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):

C#
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!!!
Posted
Comments
Member 10844306 28-May-14 2:35am    
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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900