Free Support Forum - groupdocs.com

Toolbar not showing up


#1

I’m integrating Groupdocs.Web.Annotations into a .NET web application. However, the toolbar is not showing up.


I have created a small demo application and the toolbar does show up in that application, just not my main one.

Here is the code on the cshtml page:

@Html.Groupdocs().AnnotationScripts().LoadJquery(false)
@(Html.Groupdocs()
.Annotation()
.ElementId(“annotation-widget”)
.FilePath(“Quick_Start_Guide_To_Using_GroupDocs.pdf”)
.Width(600)
.Height(800)
.ShowZoom(true)
.ShowPaging(true)
.ShowThumbnails(true)
.OpenThumbnails(false)
.ZoomToFitWidth(true)
//.Zoom(75)
.PreloadPageCount(3)
.EnableRightClickMenu(true)
.ShowFileExplorer(true)
.Tools(Groupdocs.Web.Annotation.AnnotationTools.All)
.ShowHeader(true)
.StrikeoutMode(Groupdocs.Common.StrikeoutToolMode.Remove))

And the generated BLOCKED SCRIPT

var annotationWidget = $(’#annotation-widget’).groupdocsAnnotation({
width: 600,
height: 800,
fileId: ‘Quick_Start_Guide_To_Using_GroupDocs.pdf’,
docViewerId: ‘annotation-widget-doc-viewer’,
quality: 90,
enableRightClickMenu: true,
showHeader: true,
showZoom: true,
showPaging: true,
showPrint: false,
showFileExplorer: true,
showThumbnails: true,
openThumbnails: false,
zoomToFitWidth: true,
zoomToFitHeight: false,
initialZoom: 100,
preloadPagesCount: 3,
enableSidePanel: true,
scrollOnFocus: true,
strikeOutColor: ‘’,
enabledTools: 255,
connectorPosition: 0,
saveReplyOnFocusLoss: false,
strikeoutMode: 1,
sideboarContainerSelector: ‘div.comments_sidebar_wrapper’,
usePageNumberInUrlHash: false,
textSelectionSynchronousCalculation: true,
variableHeightPageSupport: true,
useJavaScriptDocumentDescription: true,
isRightPanelEnabled: true,
createMarkup: true,
use_pdf: ‘true’,
_mode: ‘annotatedDocument’,
selectionContainerSelector: “[name=‘selection-content’]”,

graphicsContainerSelector: ‘.annotationsContainer’,

userName: ‘groupdocs@groupdocs.com’,userId: ‘3f8b6a5375337dae’

});
var annotationsViewer = $(annotationWidget).groupdocsAnnotation(‘getViewer’);
var annotationsViewerVM = $(annotationsViewer).groupdocsAnnotationViewer(‘getViewModel’);

You can see that enabledTools is 255 (all tools). However, annotationsViewerVM.canAnnotate() is false.

If I manually set canAnnotate(true) in the Chrome developer console, the toolbar appears as expected.

Any idea why I can’t see the toolbar?

#2

It looks like the problem was caused by not putting WidgetFactory.Initialize as the first line in Application_Start(). For some reason, this prevented the Signalr hub javascript from rendering. Once I placed this as the first line the toolbar started rendering.


#3

Hello Jason,

Thank you for your interest in GroupDocs. We are glad to hear that you solved this issue, thanks for sharing the solution with us. You are absolutely right - “WidgetFactory.Initialize” metod is vital, because GroupDocs.Annotation requires a folder where document’s cache should be placed. The best way is to place “WidgetFactory.Initialize” in the “Application_Start()” method of the “Global.asax”, but this can be any other place - just make sure that GroupDocs.Annotation is initialized before first use. If you have any additional questions please feel free to get back in touch.