GetResourceForHtmlHandler problem

Hi,


I have a problem that images in documents aren’t showing.

This is setup:
In global.asax:
Groupdocs.Web.UI.Viewer.InitRoutes();
Groupdocs.Web.UI.Viewer.SetRootStoragePath(Server.MapPath(ConfigurationManager.AppSettings[“document_root_storage_path”]));
Groupdocs.Web.UI.Viewer.SetLicensePath(Server.MapPath(ConfigurationManager.AppSettings[“document_groupdocs_licence_path”]));
Groupdocs.Web.UI.Viewer.EnableFileListRequestHandling(true);
Groupdocs.Web.UI.Viewer.EnableDownloadRequestHandling(true);
Groupdocs.Web.UI.Viewer.ShowExceptionDetailsOnClient(true);

I have a web api method that is generating DocumentCache:
dc.GenerateHtml(fileName, null, true, false);


And another one for previewing:
string block = Viewer.CreateScriptLoadBlock()
.LoadJquery(true)
.LoadJqueryUi(true)
.LoadKnockoutJs(true)
.UseHttpHandlers(false)
.ToString();

var groupdocsViewerScript = Viewer.ClientCode()
.TargetElementSelector("#viewer")
.FilePath(filename)
.UseHtmlBasedEngine(true, true)
.ZoomToFitWidth()
.Height(850)
.ShowHeader()
.ShowSearch()
.SearchForSeparateWords()
.SupportTextSelection()
.DownloadPdfFileIfPossible(false)
.ShowViewerStyleControl(false)
.Layout(ViewerMode.OnePageInRow)
.ShowPaging()
.UseInnerThumbnails()
.ShowThumbnails()
.OpenThumbnails()
.ShowDownload()
.LoadAllPagesOnSearch()
.ShowFolderBrowser(false)
.PreloadPagesCount(1)
.UseVirtualScrolling(false).ToString();

var sb = new StringBuilder(block);
sb.Append(groupdocsViewerScript);

return sb.ToString();

The document is shown in control, but images inside document aren’t.
So as i can see when previewing that document , i have url:
http://server/document-viewer/GetResourceForHtmlHandler?documentPath=cdc172a2-d868-4e14-aa50-7b2fb77fcf02.pdf&resourcePath=1_0.png

This url is for image on first page in document.
As you can see part of the url is GetResourceForHtmlHandler and should be GetResourceForHtml. With GetResourceForHtml , it is working.

But, this GetResourceForHtmlHandler generates your control in img tag, i cannot change that.

What should I do?






Hello Novak,


We are sorry to hear that you have such issue. According on the code we can assume that you use MVC project and you have added handlers in the web.config. Please remove the handlers from the web.config, the only thing that you need to set in the web.configs is this:

Please ensure that you have such code in the <system.webServer> section.

Also please delete the “temp” folder from the root storage, clean/rebuild the solution and then try again.

Best regards.

Hi Pavel,

I removed hpptHandlers from web.config and done everything you have said, but it’s the same.
When i’m previewing document, for example, among others, i have these two urls:

  1. http://localhost/DocPreviewService/document-viewer/GetResourceForHtmlHandler?documentPath=6ebb3ac1-dda3-4ff1-85c7-383850f7deb2.pdf&resourcePath=1_0.png&relativeToOriginal=false
  2. http://localhost/DocPreviewService/document-viewer/GetDocumentPageImage?path=6ebb3ac1-dda3-4ff1-85c7-383850f7deb2.pdf&width=150&quality=100&usePdf=True&useHtmlBasedEngine=True&rotate=False&locale=en-US&pageIndex=0
    The second one is working good, it returns first page thumbnails. But the first one still not working, as it have GetResourceForHtmlHandler instead of GetResourceForHtml.
    Can you please suggest what to do?

Thank you.

Hello,


We have checked again and we can’t reproduce your issue on our side. We don’t have second request with “GetResourceForHtmlHandler” we have only “GetResourceForHtml”. Since that please investigate our “GroupDocsViewerMVCDemo” and “ViewerConsumer” samples. The “GroupDocsViewerMVCDemo” returns Viewer code and the “ViewerConsumer” request for it and then view it. You can download them here, especially please pay attention to the web.configs and how we get Viewer code in the “ViewerConsumer”.

Best regards.

Hi ,

thank you for the examples.
Can you please show me example where your web service/web api which has two methods:
1. Upload document (and create DocumentCache)
2. Preview document (sending javascript)

I am stating that in this case you have a bug.
Bug is that you have url call to GetResourceForHtmlHandler instead of GetResourceForHtml.

Hello Novak,


I have updated MVC sample with required functional, you can download it here.

Best regards.

Hello, I am assisting Christina with this issue.


We were able to look into this today and the issue appears to be that we had HTTPHandlers for GroupDocs in our web.config. I also updated to the latest DLL. This issue is resolved.

Thanks for all of the assistance.

Hi,


Thank you for the notification. glad to hear that the issue is resolved.

Best regards.