Wednesday, February 27, 2008

Adding PDF icons to WSS 3.0-- and what went wrong when I tried it...

So I received a comment from someone on my "how to index PDFs" entry last month. Flattered, I went to take a looksee at what they wrote.

I was a little confused when the commentor mentioned that they had tried to make changes to the docicon.xml file and still couldn't get their search to work.

Hmmm, I don't remember touching the docicon.xml file when I enabled pdf indexing. I just downloaded and installed Adobe 8.x, added some registry entries, and did the necessary restarts to get sharepoint to index the files anew.

While trying to figure out why he thought docicon.xml had something to do with indexing filters, I realized that I forgot to do something important-- change the default pdf icon.

Ahh, that's what using the PDF ifilter from adobe has to do with the docicon.xml file-- to associate the correct icon for the pdf extension. I guess he thought the two processes were one in the same.

Yes, I know it's just a prettifyin' thing and not essential for search to work on PDFs, but what the heck, it's easy.

So if you don't want that pesky default blank paper icon to show up next to your PDF files in your libraries or search results, do the following:

  1. Download the icon file from adobe (or whereever, some people have better ones). Make sure it's small (the default from adobe is 17x17).

  2. Save the icon to the c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES folder. I renamed it "icpdf.gif" myself, just so it matches the format of all the other doc icon files used in the DOCICON.XML.

  3. Open the DOCICON.XML file in notepad (the DOCICON.XML file is located in the c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML folder).

  4. Once in the DOCICON.XML file, go to the "<ByExtension>" section (see figure above) and add the tag: "<Mapping Key="pdf" Value="icpdf.gif" OpenControl=""/>"(minus the quotes, they're just there to tell you what you are supposed to type-- again, blogger hates it when you add non- html tags)
    The tag means that the icon "icpdf.gif" (or whatever you named your pdf icon file) will be mapped to the .pdf extension. I do not have an open control (like using Word to edit a doc file) for pdfs, so I left it blank between the quotes.

  5. Save the file, then drop to a command prompt and do an IISRESET. This should let sharepoint know there has been a change and repopulate the pages with new icons appropriately.

    --- Important note: I could not get the pdf icon to work for the longest time. So pay heed-- the capitalization of the words "Mapping Key" OpenControl" and "Value" in the DOCICON.XML file is important. I did not capitalize the word "value", and no matter what I did, the icon would not work. So when you are working in the DOCICON.XML file, capitalizing the text in the tags is important.----

Once you have done an IISRESET on the WSS server (where, of course, all of this is taking place), you should be able to go into the library where pdf files are listed and see the correct icon next to them:

And when you do a search, the pdf files in the results should show up with the correct icon as well:
So that's what the DOCICON.XML file is for, and how to add the correct little icon images to the file extensions you use in sharepoint. Thanks Ravie.


dengel said...

F@#$ing Wizard. Thanks, folks.

Anonymous said...

LOL... the damn V got me too. Thanks for the hint!

Callahan said...

LOL. Thanks anonymous. It's nice to know I'm not the only one who had that happen. : )

Geert van Raaij said...

I did already solve the issue about the icon before I read your blog, but you made me curious when reading "I enabled pdf indexing. I just downloaded and installed Adobe 8.x, added some registry entries, and did the necessary restarts to get sharepoint to index the files..".

That's the part I didn't succeed in, as today.

What EXACT registry entries did you add? Can you please expose them ;-)

Thanx in advance, greetz Geert

Anonymous said...

such a small thing WAS such a big problem till i found your post.

Callahan said...


I'm glad that the docicon post worked for you. : ) Those registry entries needed to enable pdf indexing were listed (with screenshots) in a blog entry prior to this one--

Let me know if it works for you. Thanks for posting. : )

Anonymous said...

Nice writeup. I was able to get the icons displaying in sharepoint lists, but when I search documents and PDFS are listed.. they use IE icons instead of PDF icons. Any idears?

MindTheGap said...

Nice really clear instructions found this post similar but has a list of other useful ifilters.

Anonymous said...

Works great - Thanks

Anonymous said...

I just want you to know I have been banging my head for days over this and it all came down to the capitalization you mentioned!! Thank you so very much!!!!

Anonymous said...

Thanks! That was very helpful.