I was working on a Silverlight-based BI Dashboard in SharePoint for Pfizer.  Pfizer allows the consumers of its animal products to upload receipts and Proof of Purchases in order to qualify for rebates.  The business required the ability for Silverlight to process an array of image types, including PDFs, that the consumer may upload.  Processing included not only viewing the image, but also zoom, crop and rotate.

Since Silverlight can only process JPGs or PNGs natively, I needed a third-party provider to satisfy the business requirements.  There are many libraries that render different image formats and PDFs, but I needed a single solution to handle as many formats, again, including PDFs, as possible and accomplish the image manipulation requirements.  Therefore, we decided on Atalasoft DotImage.

While I was able to very easily get the Atalasoft imaging library working in the Silverlight web form test page, it was a little tricky getting it working in SharePoint due to the library looking for the license keys in specific locations.

Atalasoft, unfortunately, had never been approached for utilizing their solution within the SharePoint environment and, therefore, had no reference.  However, they were a great help in the exploration and testing process and I, eventually, was able to successfully implement Atalasoft with Silverlight web parts.

The following are steps to getting Atalasoft working within SharePoint.

  1. Generate the license files by running the Atalasoft Toolkit Activation Service on the Desktop.
    1. For each serial number, choose “Activate an SDK serial number to use on this machine, or a server license.”
    2. Enter the serial numbers
    3. Choose “Client App” (because these are for Silverlight)
    4. Enter the fully qualified domain name
    5. Save the .lic files to the desktop
  2. Now, because of SharePoint, the .lic files have to be located in three different locations on the SharePoint server.
    1. “C:\Atalasoft\DotImage 10.0” – for Atalasoft in general
    2. “C:\inetpub\wwwroot\wss\VirtualDirectories\80\bin” – specifically, for the SharePoint web part
    3. Finally, along side of the Silverlight application. For example, we saved the Silverlight .xap file in a Document Libraries folder “Apps\Silverlight Reporting”. Therefore, in our case, we needed to upload the .lic files here. This is for the Silverlight client app.
  3. Edit the web.config to specify the temporary cache location:
  4. Notice, in the previous step, I specified the cache location as “/TempImages” instead of “TempImages”. You must include the “/”. Otherwise, Atalasoft will think the cache location is relative to the Silverlight app and, of course, this cannot be the case since the Silverlight app is located in a SharePoint Document Libraries folder.
  5. Create the subdirectory in your SharePoint instance path. In this case, in “C:\inetpub\wwwroot\wss\VirtualDirectories\80\” (the default). Give SharePoint service user Write/Read permissions to the folder.
  6. Images are temporarily cached to this folder. However, there are two reasons why, at this point, you still wouldn’t be able to access the temporary files. First, authentication.Edit the web.config and add the following authorization to allow anonymous access to the cache folder:

  7. Finally, SharePoint’s http rewrite handler will not allow you to access the folder because it will think you are trying to access a SharePoint resource and try to rewrite the request accordingly. Therefore, we need to intercept the request before it gets to SharePoint.Remeber, there’s two things working here… the server’s web part (acting like an ASP.NET mini app) and the Silverlight client app. First, the webpart downloads the requested image into cache via the SilverlightWebHandler. Then, the Silverlight client downloads the cached image from the “TempImages” directory.The problem is, the two app’s think the “TempImages” folder is located in two different locations. The web part believes the “TempImages” folder is a subdirectory within the SharePoint app (which is correct). However, the Silverlight client app thinks the “TempImages” folder is relative to the silverlight .xap file location (i.e. the Libraries folder – in this case, http://sharepoint/Apps1/Silverlight Reporting/TempImages”).In order to intercept the request, I installed the URL Rewrite 2.0 extension in IIS. Then I configured the following settings:
    • Add Rule – “Blank Rule”
    • Name – “Image Rewrite”
    • Match URL –
      • Requested URL: Matches the Pattern
      • Using: Regular Expressions
      • Pattern: (.*)
      • Ignore case: True
    • Conditions –
      • Logical Grouping: Match all
      • Input: {URL}
      • Type: Matches the Pattern
      • Pattern: (/SitePages/tempimages/)(.*)$
      • Ignore case: True
    • Action –
      • Action type: Redirect
      • Redirect URL: http://sharepoint/tempimages/{C:2}
      • Append query string: True
      • Redirect type: Found (302)

That’s it. You’re done.