Free Support Forum - groupdocs.com

Orchard integration


#1

Is it possible to use Viewer in Orchard CMS for viewing files stored on my own server? As I understand in the example viewer integrated via iframe mapped to groupdocs.com and documents in this case should be stored on groupdocs.com. But I need a tool without any external dependencies.

If Viewer is suitable for my needs, could you please provide an example based on Orchard CMS.

#2

Hello,


Thank you for your interest in GroupDocs. Yes, you can use GroupDocs.Viewer for .NET library in your Orchard project. For how to use the library please investigate this documentation . Then you should create a web page with the Viewer or develop custom Orchard plugin with the Viewer.

If you will have any questions please feel free to contact us.

Best regards.

#3

Still can not manage to make it work.

Here is what I did (Orchard 1.8.1, .NET Framework 4.5, GroupDocs 2.13):
global.asax.cs
protected void Application_Start() {
Viewer.InitRoutes();
Viewer.SetRootStoragePath("~/");
RegisterRoutes(RouteTable.Routes);
_starter = new Starter(HostInitialization, HostBeginRequest, HostEndRequest);
_starter.OnApplicationStart(this);
}

web.config (placed in app root)

Index.cshtml
@using Groupdocs.Web.UI
@using(Script.Head()) {
@Html.CreateViewerScriptLoadBlock().LoadJquery().LoadJqueryUi();
}

@(Html.ViewerClientCode()
.TargetElementSelector("#test")
.FilePath(“bathroom.docx”)
.OpenThumbnails(false)
.ZoomToFitHeight())

Reload the page. Result (from browser’s console): in attachments
All calls to urls like /document-viewer/… are failed with 404 error.

Please help me to run GroupDocs under Orchard.

#4

Hello,


Thank you for the examples. At the first look your approach and code is correct. We have reproduced your issue and now we works on how to resolve it. Sorry but this will take some time (we will try to resolve it soon). When we will have any news for you, you will be notified here.

Sorry for the inconvenience.

#5

Hello,


Sorry for the delay. We have discussed this issue with the Orchard and they advised to use “Owin Middleware” instead of http handlers. It’s easier to do and will have access to all Orchard services besides being compatible with multi tenancy.



You can find a tutorial here: http://orcharddojo.net/blog/writing-an-orchard-owin-middleware

Thank you.

#6

Thank you. With Owin it works.


#7

Hi,


Thank you for the feedback and glad to hear that all works now.

Best regards.