GetThumbnail() public method

A synchronous version of getting thumbnails, currently used by the image server to get thumbnails that are used in the add page dialog.
public GetThumbnail ( string key, HtmlDom document, ThumbnailOptions options ) : Image
key string Used to retrieve the thumbnail from a dictionary if we are asked for /// the same one repeatedly
document Bloom.Book.HtmlDom Whose rendering will produce the thumbnail content.
options ThumbnailOptions
return Image
        private void GetThumbNailOfBookCover(Book.Book book, HtmlThumbNailer.ThumbnailOptions thumbnailOptions, Action <Image> callback, Action <Exception> errorCallback, bool async)
        {
            if (book is ErrorBook)
            {
                callback(Resources.Error70x70);
                return;
            }
            try
            {
                if (book.HasFatalError)                 //NB: we might not know yet... we don't fully load every book just to show its thumbnail
                {
                    callback(Resources.Error70x70);
                    return;
                }
                GenerateImageForWeb(book);

                Image thumb;
                if (book.Storage.TryGetPremadeThumbnail(thumbnailOptions.FileName, out thumb))
                {
                    callback(thumb);
                    return;
                }

#if USE_HTMLTHUMBNAILER_FOR_COVER
                var dom = book.GetPreviewXmlDocumentForFirstPage();
                if (dom == null)
                {
                    callback(Resources.Error70x70);
                    return;
                }
                string folderForCachingThumbnail;

                folderForCachingThumbnail = book.StoragePageFolder;
                _thumbnailProvider.GetThumbnail(folderForCachingThumbnail, book.Storage.Key, dom, thumbnailOptions, callback, errorCallback, async);
#else
                if (!CreateThumbnailOfCoverImage(book, thumbnailOptions, callback))
                {
                    callback(Resources.Error70x70);
                }
#endif
            }
            catch (Exception err)
            {
                callback(Resources.Error70x70);
                errorCallback(err);
                Debug.Fail(err.Message);
            }
        }
        public void GetThumbNailOfBookCover(Book.Book book, HtmlThumbNailer.ThumbnailOptions thumbnailOptions, Action <Image> callback, Action <Exception> errorCallback, bool async)
        {
            if (book is ErrorBook)
            {
                callback(Resources.Error70x70);
                return;
            }
            try
            {
                if (book.HasFatalError)                 //NB: we might not know yet... we don't fully load every book just to show its thumbnail
                {
                    callback(Resources.Error70x70);
                    return;
                }
                Image thumb;
                if (book.Storage.TryGetPremadeThumbnail(thumbnailOptions.FileName, out thumb))
                {
                    callback(thumb);
                    return;
                }

                var dom = book.GetPreviewXmlDocumentForFirstPage();
                if (dom == null)
                {
                    callback(Resources.Error70x70);
                    return;
                }
                string folderForCachingThumbnail;

                folderForCachingThumbnail = book.Storage.FolderPath;
                _thumbnailProvider.GetThumbnail(folderForCachingThumbnail, book.Storage.Key, dom, thumbnailOptions, callback, errorCallback, async);
            }
            catch (Exception err)
            {
                callback(Resources.Error70x70);
                Debug.Fail(err.Message);
            }
        }